To inject an EJB3 into a POJO (which is possible since Spring 2.5), I think that you should use @EJB
instead of @Resource
. Quoting Spring EJB and JPA (read it all, it has many examples):
Don't forget to add:
<context:annotation-config/>
It allows various annotations to be detected in bean classes: Spring's @Required
and @Autowired
, as well as JSR 250's @PostConstruct
, @PreDestroy
and @Resource
(if available), JAX-WS's @WebServiceRef
(if available), EJB3's @EJB
(if available), and JPA's @PersistenceContext
and @PersistenceUnit
(if available). Alternatively, you may choose to activate the individual BeanPostProcessors for those annotations.
Also have a look at Spring support for @EJB annotations: example? on the Spring forums.