In Spring wiring means configuration the bean dependency if any. It may be done explicitly by hard-coding the code in XMl file or implicitly by mentioning the required type of autowiring process in the XML file. Autowiring process is further divided into two category :
1. XML based Auto-Wiring process.
2. Annotation based Auto-Wiring process.

Explicitly wiring the dependencies in the XML is otherwise also called as XML based Explicitly Wiring.

XML based Auto-Wiring process 
There are four type by which we can achieve XML based autowiring, i.e
1. byName autowiring 
2. byType autowiring 
3. constructor autowiring 
4. Autodetect autowiring 

All the above auto-wiring process can be done by writing the respective values to the autowire attribute in the XML file. Like this,

<bean id=" " class=" " autowire="xxx" />
xxx can be :

a. byName         b. byType        c. constructor         d. autodetect

Annotation based Auto-Wiring
There are two annotations facility available in the Spring for bean dependency detection and injection. Injecting the bean through annotation based wiring is knows as Field Injection.
We are writing annotation with the field attributes that why it is named as Field Injection.

The two types of Annotation based Auto-Wiring are :
1. @Autowired annotation.
2. @Resource annotation.



Related Posts:

  • Spring AutoWiring : constructor In this type of implicit wiring, container detect the bean instance and matches by its type with the type of the bean in the XML and then identifies the matching constructor to inject the bean dependencies. Here the autowir… Read More
  • Spring Implicit Wiring : byName In this type of implicit wiring, container detect the bean instance and matches its name with the value of the id attribute as hard-coded in the XML file with the bean tag. Some task performed by the the Container : 1. Con… Read More
  • Spring Wiring Process In Spring wiring means configuration the bean dependency if any. It may be done explicitly by hard-coding the code in XMl file or implicitly by mentioning the required type of autowiring process in the XML file. Autowiring… Read More
  • Implicit/Auto Wiring in Spring The term auto itself says half the meaning of this wiring, that the things are done implicitly without the hard-coding any thing. Wiring defines the process of injection of the dependencies of the bean. So in Auto Wiring we… Read More
  • Spring AutoWiring: Autodetect It is a type of auto-wiring in which the injection procedure may be constructor or setter injection , depends on the argumented constructor is there in the bean. Container gives priority for the constructor injection and se… Read More

1 comment:

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201978

Online Members

Live Traffic