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;

}

猜你喜欢

转载自yuhuiblog6338999322098842.iteye.com/blog/2369119
今日推荐