Spring 3 part 3: Standard wiring
This is the 3rd part of the Spring 3 Series . In the part 2 of this series explained the Spring way of wiring. The part 2 examples are continued in this blog.mThis part is dedicated to standard wiring that is proposed by the Java Community Process. Spring 3 implements the JSR-330 that is @Inject annotation. The @Inject is lot common to the @Autowire but no “required” attribute. import javax.inject.Inject; import javax.inject.Named; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Parent { @Inject @Named("grandChild") private Child child; The Parent class’s child property is annotated with @Inject and @Named. Here @Named is similar to @Qualifier, for instance grandChild is declared as a Spring bean in the spring-config.xml file which is referenced in the @Named annotation. It is also possible to create custom qualifier as an alternative way. Here the custom qual...