AUTOWIRING : Avoids some of the Spring configuration.
EXAMPLE
<bean id="triangle" class="com.shaan.exmaple.Triangle" autowire="byName" />
1. BY NAME
autowire="byName"
It injects the beans by matching the name of properties in bean class with bean ID defined in XML.
2. BY TYPE
autowire="byType"
It injects the beans by matching the class type of properties in bean class with bean type defined in XML.
It is only applicable when there is only one property of that type in bean class.
3. BY CONSTRUCTOR
autowire="constructor"
It injects values at constructor running time, not by setters.
Works similarly as "byType" and used when there is only one property of that type in bean class.
4. NO AUTOWIRING
autowiring=off
By default, when you don't specify any autowiring attribute with bean tag.
In this case, wiring must be done manually.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.