I'm seeing an issue with the JSR-330 @Inject annotation not populating the ApplicationContext into my bean. When using the JSR-250 @Resource annotation it gets injected properly. Yes, I know I could have MyClass implement ApplicationContextAware, but wondering why @Resource works, but @Inject does not. I'm using spring-context version 4.1.6.RELEASE and java 8
This works:
@Named
public class MyClass {
@Resource
public ApplicationContext applicationContext;
...
}
This has ApplicationContext as null
@Named
public class MyClass {
@Inject
public ApplicationContext applicationContext;
...
}
source http://www.adam-bien.com/roller/abien/entry/what_is_the_relation_between