org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


問題描述

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'xxxxx.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Description: Field userService
in com.atguigu.gmall.user.controller.UserController required a bean of type 'xxxx.service.UserService' that could not be found. Action: Consider defining a bean of type 'xxxx.service.UserService' in your configuration.

 

解決方案 :

  1. 根據報錯, 將UserService的注解@Autowired 修改為 @Autowired(required=true)  ===> 無效

  2. 由於整合了dubbo, 修改UserService的注解為@Reference


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM