【发布时间】:2017-01-29 05:57:26
【问题描述】:
默认情况下Spring Boot会自动从classpath:/application.properties加载属性
我想知道这个自动配置源代码在哪里。
我想从我的应用程序中排除。
即:@EnableAutoConfiguration(exclude=XXXXAutoconfiguration.class)
原因是:
因为我无法使用 @PropertySource 覆盖默认的 application.properties 的外部属性
@SpringBootApplication
@ComponentScan(basePackages = {"com.test.green.ws"})
@PropertySource(value = {"classpath:/application.properties", "file:/opt/green-ws/application.properties"})
public class GreenWSApplication {
public static void main(String[] args) {
SpringApplication.run(GreenWSApplication.class, args);
}
}
【问题讨论】:
标签: spring spring-boot