type
status
date
slug
summary
tags
category
icon
password
报错原因可能如下:

1 检查是否添加了对应注解

2 检查配置是否正确,扫描包名, 类名及id是否正确

一 . 传统SSM项目

ssm项目,出现“No qualifying bean of type found for dependency ***”错误,最后定位到该bean,仔细检查,
1 首先检查是否在类上添加了对应的注解,如:@Controller @Service @Reporsitry @Component
2 然后检查配置文件,发现有没有扫描到相应的包,在配置文件中加上该包
<context:component-scan base-package=
再如:在applicationContext-Service.xml中,有没有配置所注入service
applicationContext-Service.xml:
<bean id="orderServiceImp" class="com.it.service.imp.OrderServiceImp"></bean> 3 是否有jar包依赖冲突 如:jpaj的jar包冲突

二 . spring boot项目

@Autowired - No qualifying bean of type found for dependency
1 . 主要就是检查是否在对应的类上添加了注解如:@Controller @Service @Reporsitry @Component
2 . 启动类所在的位置是否在其他被扫描类的包的前面
如:启动类要在order包.其他类在下一级包
以下为根据具体选用情况而定, 多用优先级的顺序问题
1 .是否使用在具体mapper上有到 @Mapper
2 . 是否使用在application文件中
mybatis: type-aliases-package: com.ayh.order.pojo mapper-locations: com.ayh.order.mappers 3 .是否使用在启动类上用到了@MapperScan(value="com.ayh.order.mappers")
@SpringBootApplication @EnableDiscoveryClient @EnableFeignClients @MapperScan(value = "com.ayh.order.mappers") public class OrderApplication {}
 
 
logger.info占位符的使用解决/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory报错
Loading...