首页  

springboot 加载指定的 properties文件     所属分类 springboot 浏览量 633
默认加载 classpath application.properties

可记载指定的配置文件

final String config = "xxx.properties";
Properties prop = new Properties();
InputStream inputStream = JsonDemoApp.class.getClassLoader().getResourceAsStream(config);
prop.load(inputStream);
SpringApplication application = new SpringApplication(JsonDemoApp.class);
application.setDefaultProperties(prop);
application.run(args);
        
完整代码
https://gitee.com/dyyx/springboothello/blob/master/src/main/java/jsondemo/JsonDemoApp.java


springboot禁用特定的自动配置类

上一篇     下一篇
苏轼与王安石

Springboot devtools 简介

springboot2 集成 prometheus

Java8 Stream过滤null值

string format几种方式

字符串格式化性能对比