首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MybatisAutoConfiguration$$EnhancerBySpringCGLIB构造函数抛出异常NoUniqueBeanDefinitionException

MybatisAutoConfiguration$$EnhancerBySpringCGLIB构造函数抛出异常NoUniqueBeanDefinitionException
EN

Stack Overflow用户
提问于 2018-04-22 20:20:39
回答 1查看 1.1K关注 0票数 0

在尝试将spring 1.4.2应用程序部署到tomcat 7时,我得到了这个错误:

代码语言:javascript
复制
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationServiceImpl': Unsatisfied dependency expressed through field 'applicationDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationDao' defined in file [E:\sources\apache-tomcat-7.0.86\webapps\OnlineChannelBackend-0.0.1-SNAPSHOT\WEB-INF\classes\com\pack\dao\ApplicationDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$$EnhancerBySpringCGLIB$$f214bdd7]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'java.lang.Object' available: expected single matching bean but found 4: &applicationDao,systemEnvironment,contextParameters,contextAttributes

我的相关构建级:

代码语言:javascript
复制
sourceCompatibility = 1.6 //java6
targetCompatibility = 1.6

dependencies {
    compile('org.springframework.boot:spring-boot-legacy:1.1.0.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE')
    compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2')
    compile('com.oracle:ojdbc6:11.1.0.7.0') //java6
    providedRuntime('org.apache.tomcat:tomcat-juli:7.0.59') // java6
    compile group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.59'

在com.pack.dao中,我在资源中的对应文件夹中有三个带有@Mapper注释的映射接口和相应的xml文件.这个应用程序在spring 2中运行良好,但是一旦我开始将它更改为spring 1.4.2,我就无法让它工作了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-23 01:07:52

因为它是在以前的春季版本中工作的,所以我相信您有您的配置文件,所以您可能需要为我的排除spring自动配置器。

代码语言:javascript
复制
@SpringBootApplication
@EnableAutoConfiguration(exclude = {MybatisAutoConfiguration.class})
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49970370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档