0
我有一个简单的类使用@PropertySource
像这样弹簧自动创建属性文件
@Component
@PropertySource(value = "file:${user.home}/.cooperp/app-conf.properties")
public class ApplicationProperties {
@Value("${mysql-location}")
private String mysqlLocation;
public String getMysqlLocation() {
return mysqlLocation;
}
public void setMysqlLocation(String mysqlLocation) {
this.mysqlLocation = mysqlLocation;
}
}
我知道代表的属性文件,如果文件没有找到一个可以添加ignoreResourceNotFound = true
这将使春季忽略这一情况并启动了应用。
我想春天到创建文件它没有找到,不会忽略或抛出异常。
您需要为此编写代码,这不是'@ PropertySource'的任务/函数。 –
哪里,在主要的方法? –
你为什么要这样做? – PaulNUK