liveBook · Manning

Autowiring

As explained in Spring in Action, Sixth Edition

A Spring technique that automatically supplies a bean with other beans matching its dependencies.

Autowiring lets Spring automatically inject the beans that a component depends on. Together with component scanning, it allows the application context to discover components, create beans, and connect them without configuring every relationship explicitly. section 1.1

Autowiring fits into Spring’s broader automatic-configuration approach:

  • Component scanning discovers application components on the classpath and creates them as beans. section 1.1
  • Autowiring supplies those beans to other components when they declare dependencies. section 1.1
  • Spring Boot extends these techniques with autoconfiguration based on the classpath, environment variables, and other factors. section 1.1
Figure 1.1 Application components are managed and injected into each other by the Spring application context.

Shows application components managed by the Spring application context and injected into one another. section 1.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Defines dependency injection and relates it to component scanning, but stops short of showing autowiring implementation details.
Examples
Uses a component-injection diagram alongside XML and Java bean-configuration examples.
What it assumes
Builds from Spring beans and the application context while contrasting XML and Java configuration.
What you can do after
Apply it via Spring by recognizing how discovered components receive their bean dependencies automatically.
How it connects
Connects beans with component scanning, the Spring application context, and Spring Boot autoconfiguration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.