You can auto-wire a particular property in spring, using @Autowired annotation. For using @Autowired annotation, you will have to register AutowiredAnnotationBeanPostProcessor bean instance in the spring IOC container
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />OR
You can simply include the
<context:annotation-config /> element in your bean configuration file. The <context:annotation-config /> automatically registers an instance of AutowiredAnnotationBeanPostProcessor for youFor including
<context:annotation-config /> element, you need to include context namespace in the bean definition file<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Auto wiring is supported for
1. Constructors
2. Setter Methods
3. Arbitrary Methods
4. Fields
Read more ...