小编Gre*_*ves的帖子

spring boot 在哪里配置默认的application.properties

默认情况下,Spring Boot 会自动从 classpath:/application.properties

我想知道这个自动配置源代码在哪里。我想从我的应用程序中排除。IE:@EnableAutoConfiguration(exclude=XXXXAutoconfiguration.class)

原因是:因为我无法使用外部属性覆盖默认的 application.properties @PropertySource

@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);
    }
}
Run Code Online (Sandbox Code Playgroud)

spring spring-boot

5
推荐指数
1
解决办法
4710
查看次数

标签 统计

spring ×1

spring-boot ×1