码迷,mamicode.com
首页 > 其他好文 > 详细

问题解决: @Resource annotation is not supported on static fields

时间:2015-06-18 13:43:39      阅读:757      评论:0      收藏:0      [点我收藏+]

标签:

今天做项目,需要给一个类中的静态变量使用@Resource,然后注入时候,程序报错了 @Resource annotation is not supported on static fields,原来spring annotation不支持静态变量注入,因此上网搜了一下,找到了解决的办法,就是把get,set方法的static 修饰符去掉,然后在set方法上面加@Resource即可,问题解决

问题解决: @Resource annotation is not supported on static fields

标签:

原文地址:http://blog.csdn.net/wang_huanming/article/details/46545825

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!