Spring Auto wiring
Auto wiring Resolves the beans that need to be injected by inspecting the elements in ApplicationContext.
Auto Wiring - Advantages Reduces the configuration for properties and constructor. Automatically gets updated when the configuration change.
Auto Wiring - TYPES NO - default byName byType constructor
byName public class Student { private Book javaBook; } public class Book { private String title; }
byType public class Car { private Wheel wheel; } public class Wheel { private String name; }
constructor public class College { private Student collegeStudent; public College(Student student){ this.collegeStudent = student; } public class Student { private String studentName; }
Auto Wiring – Disadvantages Missing wiring information. Explicit dependency configuration overrides auto wiring. Cannot resolve the beans if multiple beans of same type are configured.