SpringBoot项目启动Stopping service [Tomcat]

前几天搞多线程优化,发现了几个问题

1.继承Runnble接口和继承Callable接口的类不能使用依赖注入!

2.使用依赖注入的时候一定要看好,不能随便删除标签,以为我用@Component标注的标签没有没依赖,所以干掉了标签,结果漏掉了一个@Autowired没看到,发现重启工程的时候启动不起来,找了好半天的问题才发现:

注入的层对不对.   注入不对会产生这个问题.

2025-04-03 08:57:06.947 WARN 18528 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentController': Unsatisfied dependency expressed through field 'studentService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentServiceImp': Unsatisfied dependency expressed through field 'studentMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.bigdata.springbootmybatis.mapper.StudentMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2025-04-03 08:57:06.948 INFO 18528 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2025-04-03 08:57:06.964 INFO 18528 --- [ restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-04-03 08:57:07.019 ERROR 18528 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Field studentMapper in com.bigdata.springbootmybatis.service.imp.StudentServiceImp required a bean of type 'com.bigdata.springbootmybatis.mapper.StudentMapper' 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.bigdata.springbootmybatis.mapper.StudentMapper' in your configuration.怎么回事
最新发布
04-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值