@Autowired - No qualifying bean of type found for dependency

前端 未结 17 1573
自闭症患者
自闭症患者 2020-12-07 15:00

I\'ve started my project by creating entities, services and JUnit tests for services using Spring and Hibernate. All of this works great. Then I\'ve added spring-mvc to make

17条回答
  •  甜味超标
    2020-12-07 15:31

    You should autowire interface AbstractManager instead of class MailManager. If you have different implemetations of AbstractManager you can write @Component("mailService") and then @Autowired @Qualifier("mailService") combination to autowire specific class.

    This is due to the fact that Spring creates and uses proxy objects based on the interfaces.

提交回复
热议问题