本文主要是介绍Field xxxService in com.xxx required a bean of type 'com.xxxService' that could not befound,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
springboot启动报错
APPLICATION FAILED TO START
Description:
Field customUserService in
com.jz.springboooooot.controller.LoginController required a bean of
type ‘com.jz.springboooooot.service.CustomUserService’ that could not
be found.Action:
Consider defining a bean of type
‘com.jz.springboooooot.service.CustomUserService’ in your
configuration.
猜测是因为service类注入mybatis接口出错,
给dao添加@component 和 @mapper 注解
@Component@Mapperpublic interface UserDao{public SbUser findByUserName(String username);}
可以正常扫描到dao,重新启动依然报错,错误没变。
上网查发现可能是service类没有扫到。
在启动类添加注解@ComponentScan(“com.jz.springboooooot.service”)手动扫描service类
重新启动不报错,确定是s
这篇关于Field xxxService in com.xxx required a bean of type 'com.xxxService' that could not befound的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!