zoukankan      html  css  js  c++  java
  • peizhiwenjian

    自定义配置文件

    如果你不想使用application.properties作为配置文件,怎么办?完全没问题

    java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties

    或者

    java -jar -Dspring.config.location=D:configconfig.properties springbootrestdemo-0.0.1-SNAPSHOT.jar 

    当然,还能在代码里指定

    @SpringBootApplication
    @PropertySource(value={"file:config.properties"})
    public class SpringbootrestdemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(SpringbootrestdemoApplication.class, args);
        }
    }

     或者

    修改

    在application.properties中支持指定j2cache配置文件,让你开发环境和生产环境分离

    j2cache.config-location=/j2cache-${spring.profiles.active}.properties
    /ABC/J/D/DEEE
    j2cache.config-location=/classpath:config/jdbc222222.properties

  • 相关阅读:
    Swift-基础语法之变量&常量&元组
    Swift
    安装MySQL
    LNMP 简介
    LNMP
    Django 定义数据模型
    Django 添加应用
    Django 创建第一个项目
    Django 安装
    Django 简介
  • 原文地址:https://www.cnblogs.com/xingzc/p/9557367.html
Copyright © 2011-2022 走看看