springboot出现Consider defining a bean of type ‘xxx‘ in your configuration解决方案
springboot 出现 Consider defining a bean of type 'xxx' in your configuration解决方案1.检查自己写的注解是否错了,没有see down。2.在网上查找解决方式:如下所示:步骤一:在springboot的配置文件添加,mybatis的配置如下所示:mybatis:typeAliasesPackage: com.xxx.xxx.d
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 {
}
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)