Springboot启动出现A component required a bean of type ‘com.xxx‘ that could not问题解决

今日写一个websocket小demo,启动项目时出现错误如下图
图片[1] - Springboot启动出现A component required a bean of type ‘com.xxx‘ that could not问题解决 - MaxSSL
检查也没发现漏写注解,思考片刻后突然想起springboot扫描的范围是与启动类同级别的包-就是com.huang.demo.ssm目录下所有注解bean都被扫描,那么ws包里面的bean不在ssm这个路径下,所以导致springboot启动时扫描不到。最后把ws包及文件移到ssm下面启动没问题。
图片[2] - Springboot启动出现A component required a bean of type ‘com.xxx‘ that could not问题解决 - MaxSSL

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享