Saturday, June 2, 2012

Spring Framework- Autowiring and Types of Autowiring


In large application Explicit wiring provide a lot of xml code . To solve out or simplify it use autowiring or implicit wiring. Spring provide four types autowiring-
1. byName-Use to find bean in container whose id is same as the name of the property of specified bean.     
                  (Click  to see Example )
2.byType-   Use to  find bean in container whose type match the type of the property of specified bean. if more than one bean type is found it thrown exception(UnsatisfiedDependencyException).Click to see Example.
3.constructor-Use to match the one or more beans in the container with the parameters of the constructors of the specified bean.(Click to see Example)
4.autodetect-It automatically detect the wiring.basically it autowire constructor first then byType and byName.
(Click to see Example)

==> Spring also provide the autowiring with the annotations.


For Further Reading,
General, Java, spring

0 comments:

Post a Comment


 

Site Status

Man Behind Technical Today

Hello, I am Navin Bansal. I am a student of MCA in Rajsthan Institute of Engineering and Technology and owner of this blog. I share my view and ideas among people.