Reputation: 1825
My xml looks like this:
<bean name="subscriberStore" class="java.util.HashSet" scope="singleton"/>
And I have the following code:
@Value("#{subscriberStore}")
private static HashSet<Subscriber> subscriberStore;
However, later in the above class, when I call methods on subscriberStore I get a null pointer exception. I've tried using @Autowired
and @Resource
in place of @Value ..
above but it makes no difference.
Anyone have any ideas why the subscriber store is not getting initialized?
Thanks!
Upvotes: 1
Views: 389
Reputation: 42849
You cannot @Autowire
static fields. Consider removing the static
modifier, if possible.
Upvotes: 6