【发布时间】:2015-01-30 10:55:10
【问题描述】:
似乎 spring-boot 启动器在以下位置查找 application.{xml|properties|yml|yaml} 文件以加载属性。有没有办法指定不同的文件名或文件来加载属性?
$ java -Ddebug -jar target/app-1.0.jar
16 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./config/application.properties' resource not found
16 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./config/application.yaml' resource not found
16 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./config/application.yml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/application.properties' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/application.xml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/application.yaml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/application.yml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/config/application.properties' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/config/application.xml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/config/application.yaml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'classpath:/config/application.yml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./application.properties' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./application.xml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./application.yaml' resource not found
32 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./application.yml' resource not found
6 [main] DEBUG org.springframework.boot.context.config.ConfigFileApplicationListener - Skipped config file 'file:./config/application.xml' resource not found
编辑:
有没有办法指定另一个 Bean 配置文件(如 application-context.xml)?
【问题讨论】:
标签: java spring spring-boot