Spring boot启动失败

Spring boot 启动失败,报错:

ERROR:  Spring boot start failed:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminUserController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.com.jsoft.service.IAdminUserService cn.com.jsoft.controller.AdminUserController.service; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.jsoft.service.IAdminUserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 问题原因是spring boot启动的入口所在的包名与扫描要注册bean的controller处于同级目录。

修改为Spring boot启动类在最外层的package下,问题即可解决。

猜你喜欢

转载自faithlove.iteye.com/blog/2283847