Spring framework provides the way to inject the bean dependencies
using the autowire functionality. By default autowire functionality
is disabled in spring framework. A developer explicitly define the
autowiring configuration in spring configuration xml file. And this
point is to remember that autowiring is only supported for object
dependencies.
The difference between byType and byName autowiring is as follows :
You can also read such more blogs at our Java Development Blogs section.
You can also ask question related to Java at our Java developer forum.
The difference between byType and byName autowiring is as follows :
- Autowire byType will search for a bean in configuration file, whose id match with the property type to be wired whereas autowire byName will search for a bean whose id is matching with the property name to be wired.
- As a syntax wise difference is as follows:
package com.evon;
public class Company { private Employee emp; public String setEmp(Employee emp) { this .emp = emp; } }
You can also read such more blogs at our Java Development Blogs section.
You can also ask question related to Java at our Java developer forum.
No comments:
Post a Comment