Spring MVC 通过@Value注解读取.properties配置结果为null

来源:互联网 发布:淘宝的亚马逊旗舰店 编辑:程序博客网 时间:2024/05/16 08:58

@Value("${ebusinessid}")

取出的值一直是空的,检查了下spring文件,正常扫描~


后来才发现定义的成员变量为static,去掉即解决...

参考QA:

http://stackoverflow.com/questions/7253694/spring-how-to-inject-a-value-to-static-field

http://stackoverflow.com/questions/6897201/an-alternative-to-value-annotation-in-static-function

1 0
原创粉丝点击