What is autowiring in the Spring framework? Explain its type?

What is autowiring in the Spring framework? Explain its type?

You wire all of your bean's properties explicitly using the  element, However you can have Spring wire them automatically by setting the 'autowire' property on each  that you want autowired:
  

There are four types of autowiring:
  * byName :- Attempts to find a bean in the container whose name is the same as the name of the property being wired.
  * byType :- Attempts to find a single bean in the container whose type matches the type of the property being wired. If no matching bean is found, the property will not be wired.
  * constructor :- Tries to match up one or more beans in the container with the parameters of one of the constructors of the bean being wired.
  * autodetect :- Attempts to autowire by constructor first and then using byType. Ambiguity is handled the same way as with constructor and byType wiring.

By:Jalees
Date:2031-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Spring sub Links

Spring sub interview questions and answers for experienced and fresher