标签:
<!-- enable processing of annotations such as @Autowired and @Configuration --> <context:annotation-config/>
Activates 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. Note: This tag does not activate processing of Spring‘s @Transactional or EJB3‘s @TransactionAttribute annotation. Consider the use of the <tx:annotation-driven> tag for that purpose. See javadoc for org.springframework.context.annotation.AnnotationConfigApplicationContext for information on code-based alternatives to bootstrapping annotation-driven support. from XML.
JSR Java Specification Request
激活注解类
@AutoWired
总结:
@Required
@Required public void setName(String name) { this.name = name; }
<bean class="cn.zno.Person"> <property name="name" value="xiaoming"></property> </bean>
标签:
原文地址:http://www.cnblogs.com/zno2/p/4689681.html