Skip to content
Search

Org.springframework.beans.factory.annotation.Autowired

lastmod 2015-04-26created 2015-04-261 edits

About

Taken literally, the word @Autowired means that wiring will be done automatically.

Instead of writing a separate bean in XML (ApplicationContext) to perform DI, you explicitly write the Autowired annotation on the object or method that should receive DI. If the Autowired annotation is written explicitly in front of an object or method, there is no need to write a setter method for that object to receive DI. What must exist to receive DI is a setter method: when DI passes a bean from XML, a constructor or setter method is needed in the *.java file to receive the bean, and the Autowired annotation indicates that this work does not have to be done.

Favorite site