【问题标题】:spring boot adding another properties file to the environmentspring boot 向环境中添加另一个属性文件
【发布时间】:2015-01-12 04:43:24
【问题描述】:
我想知道除了 application.properties 文件之外,是否可以向环境路径添加另一个属性文件。如果是这样,您如何指定新路径?因此,您可以使用 Autowired Environment 变量访问属性。目前在我的 java 项目中,默认属性文件 application.properties 的路径是 /soctrav/src.main.resources/application.properties
【问题讨论】:
标签:
java
spring
properties
【解决方案1】:
如果您想在没有命令行参数的情况下执行此操作,则可以解决问题。
@SpringBootApplication
@PropertySources({
@PropertySource("classpath:application.properties"),
@PropertySource("classpath:anotherbunchof.properties")
})
public class YourApplication{
}