Spring MVC无法自动收集?

Ror*_*ory 1 java spring

我的xml看起来像这样:

<bean name="subscriberStore" class="java.util.HashSet" scope="singleton"/> 
Run Code Online (Sandbox Code Playgroud)

我有以下代码:

@Value("#{subscriberStore}")
private static HashSet<Subscriber> subscriberStore;
Run Code Online (Sandbox Code Playgroud)

但是,在上面的类中,当我在subscriberStore上调用方法时,我得到一个空指针异常.我尝试过使用@Autowired@Resource不是@Value ..上面但它没有任何区别.

任何人都有任何想法为什么订户商店没有初始化?

谢谢!

nic*_*ild 6

你不能@Autowire静态字段.static如果可能,请考虑删除修改器.