springboot 出现 Consider defining a bean of type 'xxx' in your configuration解决方案
1.检查自己写的注解是否错了,没有see down。
2.在网上查找解决方式:如下所示:
步骤一:
在springboot的配置文件添加,mybatis的配置如下所示:
mybatis:
typeAliasesPackage: com.xxx.xxx.dao.entity
mapperLocations: classpath:mapper/*.xml
步骤二:
1、在启动类上加上@MapperScan或者@ComponentScan注解,手动指定application类要扫描哪些包下的注解,如下所示:
@SpringBootApplication@ComponentScan(basePackages = {"com.xxx.xxx.dao"})
2、或者在接口上添加@Mapper注解。
@Mapper
public interface UserMapper {
}
更多推荐
springboot出现Consider defining a bean of type ‘xxx‘ in your configuration解决方案
发布评论