SpringBoot整合Mybatis报错:Consider defining a bean of type 'xx.xx.xx' in your configur
2018-01-26 20:29
906 查看
SpringBoot和mybatis整合完后,如果按照spring的整合习惯,可能会发现一个错误:
APPLICATION FAILED TO START
***************************
Description:
Field entFileDao in com.alibaba.serviceImpl.EntFileServiceImpl required a bean of type 'com.alibaba.dao.EntFileDao' that could not be found.
Action:
Consider defining a bean of type 'com.alibaba.dao.EntFileDao' in your configuration.
这是由于springBoot启动时,没有扫描到com.alibaba.dao.EntFileDao ,而在com.alibaba.serviceImpl.EntFileServiceImpl中又使用了@autowired
private EnfileDao entFileDao进行装配,所以会发现错误,说没有定义。此时需要在springBoot的启动类上,加个注解:@MapperScan("持久层路径"),这样就会扫描到com.alibaba.dao.EntFileDao了。
完整整合步骤可参考:Spring Boot---(8)SpringBoot整合mybatis
APPLICATION FAILED TO START
***************************
Description:
Field entFileDao in com.alibaba.serviceImpl.EntFileServiceImpl required a bean of type 'com.alibaba.dao.EntFileDao' that could not be found.
Action:
Consider defining a bean of type 'com.alibaba.dao.EntFileDao' in your configuration.
这是由于springBoot启动时,没有扫描到com.alibaba.dao.EntFileDao ,而在com.alibaba.serviceImpl.EntFileServiceImpl中又使用了@autowired
private EnfileDao entFileDao进行装配,所以会发现错误,说没有定义。此时需要在springBoot的启动类上,加个注解:@MapperScan("持久层路径"),这样就会扫描到com.alibaba.dao.EntFileDao了。
完整整合步骤可参考:Spring Boot---(8)SpringBoot整合mybatis
相关文章推荐
- Spring Boot:Consider defining a bean of type '*.*.*' in your configuration
- 关于spring boot自动注入Consider defining a bean of type 'X' in your configuration
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案 标签: spring 201
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
- 关于spring boot自动注入出现Consider defining a bean of type 'xxx' in your configuration问题解决方案
- spring boot+mybatis 多数据源报错 No qualifying bean of type [javax.sql.DataSource] is defined:
- Consider defining a bean of type ‘tk.mybatis.mapper.common.Mapper’ in your configuration.
- spring boot+mybatis 多数据源报错 No qualifying bean of type [javax.sql.DataSource] is defined:
- Spring Boot + MyBatis No qualifying bean of type
- Consider defining a bean of type 'com.xxx.service.impl.xxxImpl' in your configuration
- 处理异常:Consider defining a bean of type 'xxx' in your config
- Maven多模块开发Action:Consider defining a bean of type '*.*.*' in your configuration解决
- idea中mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found解决办法
- Consider defining a bean of type 'app.mapper.UserMapper' in your configuration.
- MyBatis映射错误,No qualifying bean of type 'xx.xx.UserDao' available
- Consider defining a bean of type 'com.taikang.service.ChongyGameInfoService' in your configuration.
- spring boot 与mybatis整合,type-aliases-package、type-handlers-package等配置不起作用,导致类加载失败
- Springboot+mybatis实现typeAliasesPackage正则扫描package中的bean
- spring-session整合redis集群的时候,No qualifying bean of type [org.springframework.session.SessionRepository