Pages

Wednesday, February 6, 2008

DI annotations supported by Spring

org.springframework.beans.factory.annotation.Required
  • Identifies bean property setters that must be called (as opposed to optional setters). Supported since Spring 2.0.
org.springframework.beans.factory.annotation.Autowired
  • Spring 2.5's central injection annotation, applying to constructors, config methods and fields. Performs injection of components by type, with supporting for qualifier annotations that narrow the potential set of candidates in case of multiple matches.
javax.annotation.PostConstruct
  • JSR-250's common annotation for what Spring calls init methods.
javax.annotation.PreDestroy
  • JSR-250's common annotation for what Spring calls destroy methods.
javax.annotation.Resource
  • JSR-250's common annotation for injecting an external component by name. A resource in JSR-250 terminology really refers to a middleware component such as a DataSource.
javax.xml.ws.WebServiceRef
  • @Resource-like, for JAX-WS service lookups, injecting a JAX-WS port proxy.
javax.ejb.EJB
  • @Resource-like, for EJB Session Bean lookups, injecting an EJB component reference.
javax.persistence.PersistenceUnit
  • injecting a JPA EntityManagerFactory by persistence unit name(supported since Spring 2.0).
javax.persistence.PersistenceContext
  • injecting a JPA EntityManager by persistence unit name(supported since Spring 2.0).

No comments:

Post a Comment