dimanche 1 mars 2015

@Autowired problems with spring-boot

I found on SO many similar issues about failed injection of beans. Many time is an error about configuration (@componentScan base package to found the beans). But my case is a little bit different:


I get the same error if I try to inject with @Autowired. I checked inside the Spring application context which beans are defined and I found the two beans that @Autowired fail on injection.


Now, my workaround is: Do not @Autowire, but take it from applicationContext by beanName.


But I want to understand why the @Autowire annotation fail.


Thanks in advance


Luis


p.s. This is my prj structure



  • root/Application (@SpringBootApplication & @EnableAutoConfiguration)

  • root/Configuration extends Neo4jConfiguration (@Configuration,@EnableRepository (w/ base package) & @ComponentScan

  • root/controller/CustomController (@Controller)

  • root/model/Model (@NodeEntity)

  • root/repositoty/CustomRepository (@Repository)


Aucun commentaire:

Enregistrer un commentaire