springboot系统配置化处置
springboot系统配置化处理
springboot系统配置化处理
springboot读取配置文件用占位符的方式
不必像常规spring那样配置一个加载这个配置文件的工厂类自后才能用,这里直接用(导入依赖的时候就默认配置好了)
@Value("${cas.server.host.url}")
private String casServerUrl;
这样就可以用了,如果比较多就包装在类中用set,get方法
public String getCasServerUrl() {
return casServerUrl;
}
public void setCasServerUrl(String casServerUrl) {
this.casServerUrl = casServerUrl;
}