[Solved] Understanding @autowired annotation [duplicate]


In the java class Bean2 you have to organize your imports, the Bean1 should be imported though.

Besides you have to do configure your components scan due to autowiring and component scanning. Either you use Java or XML configuration. You can check some examples here: https://www.mkyong.com/spring/spring-auto-scanning-components/

you can find the official Spring reference here:
https://docs.spring.io/spring/docs/5.0.0.RELEASE/spring-framework-reference/core.html#spring-core

solved Understanding @autowired annotation [duplicate]