Skip to main content

Autowiring

Learn Autowiring (Injection & Wiring, Spring Core) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is Autowiring? Autowiring is the Spring feature that lets the container inject object dependencies automatically , without you naming them in the configuration file. Why? Suppose Employee depends on Address . Without autowiring you wire the reference by hand: That ref="a" is the line autowiring removes. The container works out for itself which bean fits, creates it, and injects it - so the same work gets done with no XML for it.

More lessons in Injection & Wiring