我正在将我的应用程序升级到Spring Boot 2.0.6。 Maven构建并运行,单元测试正常。在运行时,虽然通过
启动应用程序容器我一直看到此错误:-
2018-11-21 11:55:30,190警告 o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext- 上下文初始化期间遇到异常-取消 刷新尝试: org.springframework.beans.factory.BeanCreationException:错误 创建名称为“ methodValidationPostProcessor”的bean 类路径资源
[org / springframework / boot / autoconfigure / validation / ValidationAutoConfiguration.class]: 通过工厂方法实例化Bean失败;嵌套异常为 org.springframework.beans.BeanInstantiationException:失败 实例化 [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: 工厂方法'methodValidationPostProcessor'抛出异常;嵌套的 例外是java.lang.StackOverflowError。
父pom中的依赖项如下-
`<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
</parent>
<properties>
<capitalone.project.version>3.0.1</capitalone.project.version>
<jackson.version>2.9.7</jackson.version>
<junit.version>4.12</junit.version>
<junit-platform.version>1.1.0</junit-platform.version>
<sl4j.version>1.7.25</sl4j.version>
<spring-data-releasetrain.version>Lovelace-RELEASE</spring-data-releasetrain.version>
<mongodb.version>3.8.2</mongodb.version>
<pmd.version>3.11.0</pmd.version>
<jacoco.version>0.8.2</jacoco.version>
<docker.useConfigFile>false</docker.useConfigFile>
<mockito.version>2.23.0</mockito.version>
<docker-maven-plugin.version>1.2.0</docker-maven-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<sonar-maven-plugin.version>3.5.0.1254</sonar-maven-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<commons-beanutils.version>1.9.3</commons-beanutils.version>
<hibernate-validator.version>6.0.13.Final</hibernate-validator.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${sl4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>${spring-data-releasetrain.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RELEASE</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>`
The pom of my project inherits the above dependencies as it is its parent. Additionally it has the following dependencies defined in it -
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hamcrest.version>1.3</hamcrest.version>
<querydsl.version>4.2.1</querydsl.version>
</properties>
<dependencies>
<dependency>
<groupId>com.capitalone.dashboard</groupId>
<artifactId>core</artifactId>
<version>${capitalone.project.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
<version>${querydsl.version}</version>
<exclusions>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
我现在用完所有选项。看起来它正在进入某种周期性依赖关系,但不确定是什么会解决它。任何帮助将不胜感激。
答案 0 :(得分:1)
为了对其他人有帮助,我发现这篇文章的栈跟踪几乎相同-https://github.com/ulisesbocchio/jasypt-spring-boot/issues/50
对我来说,问题仍然存在于Spring boot 2.1.0.RELEASE以及该github论坛帖子中指定的所有其他版本。
最终,当我通过intellij作为正常的Spring Boot App运行应用程序时(是的,以应用程序身份运行),它开始在控制台中引发另一个错误,提示我的属性文件中的属性名称是驼峰式的,并且它们必须全部用小写,并且可以带有破折号(-)。更改所有属性名称后,可以实例化Bean,然后启动应用程序。