<&书信电报;弹簧防尘套1.1.6>&燃气轮机;“线程中的异常”;“主要”;org.springframework.beans.factory.BeanDefinitionStoreException
我是SpringBoot新手,使用SpringBoot1.1.6构建应用程序。基本应用程序运行良好 但是当我添加了一些依赖项时,我无法启动应用程序,并且在启动过程中看到以下异常 我的build.gradle文件<&书信电报;弹簧防尘套1.1.6>&燃气轮机;“线程中的异常”;“主要”;org.springframework.beans.factory.BeanDefinitionStoreException,spring,inversion-of-control,spring-boot,Spring,Inversion Of Control,Spring Boot,我是SpringBoot新手,使用SpringBoot1.1.6构建应用程序。基本应用程序运行良好 但是当我添加了一些依赖项时,我无法启动应用程序,并且在启动过程中看到以下异常 我的build.gradle文件 ` buildscript { ext { springBootVersion = '1.1.6.RELEASE' } repositories { maven { url "http://repo.spring
` buildscript {
ext {
springBootVersion = '1.1.6.RELEASE'
}
repositories {
maven {
url "http://repo.spring.io/libs-snapshot"
}
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
sourceCompatibility = 1.7
compileJava {
targetCompatibility = 1.7
}
war {
baseName = 'gs-convert-jar-to-war'
version = '0.1.0'
}
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.spring.io/libs-snapshot" }
maven { url "http://maven.springframework.org/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
exclude module: "spring-boot-starter-tomcat"
exclude module:"spring-boot-starter-logging"
}
providedRuntime("org.springframework.boot:spring-boot-starter-jetty:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
compile("com.google.guava:guava:17.0")
compile("com.squareup.retrofit:retrofit:1.6.0")
compile("commons-io:commons-io:2.4")
compile("com.local.abdd:abdd-jith912:1.0.4-SNAPSHOT"){
exclude module:"slf4j-api"
}
compile("com.local.abdd:abdd-jith912:1.0.4-SNAPSHOT:tests"){
exclude module:"slf4j-api"
}
testCompile("junit:junit")
compile("org.slf4j:slf4j-api:1.7.7"){
force = true
}
compile("org.slf4j:slf4j-log4j12:1.7.7"){
force=true
}
compile("org.slf4j:slf4j-jdk14:1.7.7"){
force=true
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
`
我的gradle dependencies输出太大,无法在此输入。
然而,我发现一些spring组件用作可传递依赖项,如
| +--- com.local.infra.thirdparty:oracle-simplefan:11.2.0.2
| | | | | | +--- javax.jms:jms:1.1
| | | | | | +--- org.springframework:spring-jms:3.1.1.RELEASE
| | | | | | | +--- aopalliance:aopalliance:1.0
| | | | | | | +--- org.springframework:spring-aop:3.1.1.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | +--- org.springframework:spring-beans:3.1.1.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | +--- org.springframework:spring-context:3.1.1.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | +--- org.springframework:spring-core:3.1.1.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | \--- org.springframework:spring-tx:3.1.1.RELEASE -> 3.2.2.RELEASE
| | | | | | | +--- aopalliance:aopalliance:1.0
| | | | | | | +--- org.springframework:spring-beans:3.2.2.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | \--- org.springframework:spring-core:3.2.2.RELEASE -> 4.0.7.RELEASE (*)
及
我不是100%肯定这会解决你的问题,但它会把事情推向正确的方向 您有许多依赖项与来自同一Spring项目的其他依赖项不同步。例如,您在Spring框架依赖项中混合了多个版本。大多数是4.0.7.0版本,但少数是3.x.x版本 解决此问题的一种方法是在有问题的模块上添加一个明确的、直接的依赖项(Spring Boot将为您提供正确的版本。例如:
dependencies {
compile 'org.springframework:spring-context-support'
compile 'org.springframework:spring-jms'
compile 'org.springframework:spring-tx'
compile 'org.springframework:spring-security-acl'
compile 'org.springframework:spring-security-taglibs'
}
尝试进行此更改并再次查看
gradle dependencies
的输出。如果您在同一Spring项目中发现任何其他模块的版本与其其他模块的版本不一致,请重复此过程。一旦这些版本看起来都正常,请再次尝试运行您的应用程序。you尚未添加所有依赖项。这是一个非常重要的问题建议在添加部件时使用Spring Boot starter项目,或者至少使用Spring Boot提供的依赖版本。请添加您的pom.Hi Deinum,感谢您的帮助。我使用的是来自的build.gradle文件,其中包含引用我的本地存储库的其他条目。请不要将文件作为注释添加,编辑并扩展您的initial问题。如前所述,请添加您的gradle文件。在不知道您更改了什么的情况下指向原始文件将不起作用。您能用gradle dependencies
的输出更新您的问题吗?Gr8!明确指定dependency起了神奇的作用。感谢Andy Wilkinson和Deinum。
+--- org.springframework.security:spring-security-core:3.0.4.RELEASE -> 3.2.5.RELEASE (*)
| | | | | | | +--- org.springframework.security:spring-security-taglibs:3.0.4.RELEASE
| | | | | | | | +--- org.springframework.security:spring-security-web:3.0.4.RELEASE -> 3.2.5.RELEASE (*)
| | | | | | | | +--- org.springframework.security:spring-security-acl:3.0.4.RELEASE
| | | | | | | | | +--- org.springframework.security:spring-security-core:3.0.4.RELEASE -> 3.2.5.RELEASE (*)
| | | | | | | | | \--- org.springframework:spring-context-support:3.0.3.RELEASE -> 3.2.2.RELEASE (*)
| | | | | | | | \--- org.springframework:spring-web:3.0.3.RELEASE -> 4.0.7.RELEASE (*)
| | | | | | | +--- org.springframework.security:spring-security-config:3.0.4.RELEASE -> 3.2.5.RELEASE (*)
dependencies {
compile 'org.springframework:spring-context-support'
compile 'org.springframework:spring-jms'
compile 'org.springframework:spring-tx'
compile 'org.springframework:spring-security-acl'
compile 'org.springframework:spring-security-taglibs'
}