Consider defining a bean of type ‘tk.mybatis.mapper.common.Mapper’ in your configuration.

来源:互联网 发布:mysql主从复制配置 编辑:程序博客网 时间:2024/04/29 00:07

Description:
Field mapper in com.XXX.comm.BaseServiceImpl required a bean of type ‘tk.mybatis.mapper.common.Mapper’ that could not be found.
Action:
Consider defining a bean of type ‘tk.mybatis.mapper.common.Mapper’ in your configuration.

关键字:
No qualifying bean found for dependency [tk.mybatis.mapper.common.Mapper com.xx.model.QixiGameInfo>]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/  ___)| |_)| | | | | || (_| |  ) ) ) )  '  |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot ::        (v1.4.1.RELEASE)...............[ WARN ] [2017-07-26 13:50:33:033] org.springframework.beans.factory.support.DefaultListableBeanFactory [1490] [main]- Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserInfoMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMap[ WARN ] [2017-07-26 13:50:33:033] org.springframework.beans.factory.support.DefaultListableBeanFactory [1490] [main]- Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRelationMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserRelationMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMap[ WARN ] [2017-07-26 13:50:33:033] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext [549] [main]- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queryGameListController': Unsatisfied dependency expressed through field 'xxxService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxServiceImpl': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [tk.mybatis.mapper.common.Mapper<com.xx.model.QixiGameInfo>]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\xxxMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMapRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserInfoMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMapRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRelationMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserRelationMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMapRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\xxxMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMapRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserInfoMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMapRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRelationMapper' defined in file [G:\workspace-s\xxWorkspace\qixi\qixi-dao\target\classes\com\xx\dao\UserRelationMapper.class]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xx.dao.xxxMapper.universeListResultMap[ INFO ] [2017-07-26 13:50:33:033] org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean [551] [main]- Closing JPA EntityManagerFactory for persistence unit 'default'[ INFO ] [2017-07-26 13:50:33:033] com.alibaba.druid.pool.DruidDataSource [1383] [main]- {dataSource-1} closed[ INFO ] [2017-07-26 13:50:33:033] org.apache.catalina.core.StandardService [183] [main]- Stopping service Tomcat[ INFO ] [2017-07-26 13:50:33:033] org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer [101] [main]- Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.[ ERROR] [2017-07-26 13:50:33:033] org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter [42] [main]- ***************************APPLICATION FAILED TO START***************************Description:Field mapper in com.xx.comm.BaseServiceImpl required a bean of type 'tk.mybatis.mapper.common.Mapper' that could not be found.Action:Consider defining a bean of type 'tk.mybatis.mapper.common.Mapper' in your configuration.

这个问题找了两个小时!!!!!最后居然是大小写的问题。。。

<resultMap id="UListResultMap"  type="com.XXX.GameUniverseVO">  </resultMap><select id="queryUListById" parameterType="String" resultMap="uListResultMap"></select>

上边的resultMap引用的id大小写错误。。。崩溃

后来又会遇到类似的问题:
只要是找xml配置,你总会找到原因的。
比如parameterType写成了parameterMap等。

阅读全文
0 0