解决springBoot项目启动失败, - @org.springframework.beans.fa,,that could not be found.

时间:2024-03-21 18:15:43

springBoot项目启动失败,

报错信息如下:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

2019-12-08 17:25:19.479 ERROR 18160 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Field userService in com.ultrapower.wuyongchang.controller.UserController required a bean of type ‘com.ultrapower.wuyongchang.service.UserService’ that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type ‘com.ultrapower.wuyongchang.service.UserService’ in your configuration.

Disconnected from the target VM, address: ‘127.0.0.1:61432’, transport: ‘socket’

在报错信息中,加粗的内容为我们写代码时,导致出现的问题所在!

回头看发现没有加相应的注解

@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)

解决springBoot项目启动失败,	- @org.springframework.beans.fa,,that could not be found.

我现在加上

解决springBoot项目启动失败,	- @org.springframework.beans.fa,,that could not be found.

查看运行结果,还是不行,解决springBoot项目启动失败,	- @org.springframework.beans.fa,,that could not be found.

最后我在启动类里加上下面这注解就OK了

@MapperScan(value=“com.ultrapower.wuyongchang.mapper”)

解决springBoot项目启动失败,	- @org.springframework.beans.fa,,that could not be found.

运行也就没有问题了