我目前正在使用JAVA 11将Spring Boot(2.1.5)应用程序升级到gradle版本'5.4.1'。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: Receiver class org.apache.bval.jsr303.ConfigurationImpl does not define or inherit an implementation of the resolved method abstract getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider; of interface javax.validation.Configuration.
相关依赖项:
休眠核心:5.4.3。最终
休眠验证器:6.0.17。最终
我曾尝试降级hibernate-validator并尝试显式指定validation-api版本,但似乎无济于事。
Build.Gradle
buildscript {
ext {
springBootVersion = '2.1.5.RELEASE'
}
repositories {
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
compileJava {
sourceCompatibility = '11'
targetCompatibility = '11'
}
apply plugin: 'application'
apply plugin: 'maven'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'idea'
mainClassName = 'io.app.ams.Application'
bootJar {
mainClassName 'io.app.ams.Application'
launchScript()
}
springBoot {
mainClassName 'io.app.ams.Application'
buildInfo()
}
bootRun {
sourceResources sourceSets.main
}
apply from: 'liquibase.gradle'
apply from: 'gatling.gradle'
configurations {
providedRuntime
}
defaultTasks 'bootRun'
repositories {
mavenLocal()
maven { url 'http://repo.spring.io/milestone' }
maven { url 'http://repo.spring.io/snapshot' }
maven { url 'https://repository.jboss.org/nexus/content/repositories/releases' }
maven { url 'https://oss.sonatype.org/content/repositories/releases' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'http://repo.maven.apache.org/maven2' }
flatDir {
dirs 'libs'
}
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-validation')
testImplementation 'org.scalatest:scalatest_2.11:3.0.0'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'io.dropwizard.metrics', name: 'metrics-core'
compile group: 'io.dropwizard.metrics', name: 'metrics-graphite'
compile group: 'io.dropwizard.metrics', name: 'metrics-healthchecks'
compile group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-servlet', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-json', version: dropwizard_metrics_version
compile group: 'io.dropwizard.metrics', name: 'metrics-servlets'
// kafka
compile group: 'org.springframework.kafka', name: 'spring-kafka', version: kafka_version
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.18'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-json-org', version: jackson_version
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hppc', version: jackson_version
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate4', version: jackson_version
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names'
compile(group: 'com.zaxxer', name: 'HikariCP', version: HikariCP_version) {
exclude(module: 'tools')
}
compile group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang_version
compile group: 'commons-io', name: 'commons-io', version: commons_io_version
compile group: 'javax.inject', name: 'javax.inject', version: javax_inject_version
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
compile group: 'joda-time', name: 'joda-time', version: '2.10.2'
compile group: 'org.apache.geronimo.javamail', name: 'geronimo-javamail_1.4_mail', version: geronimo_javamail_1_4_mail_version
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.4.3.Final'
compile group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.1.0.Alpha5'
compile group: 'org.hibernate', name: 'hibernate-envers', version: '5.4.3.Final'
compile group: 'org.hibernate', name: 'hibernate-ehcache' ,version: '5.4.3.Final'
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
compile group: 'org.jadira.usertype', name: 'usertype.core', version: '7.0.0.CR1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-parent', version: '2.1.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.1.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-properties-migrator', version: '2.1.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
compile group: 'org.springframework.boot', name: 'spring-boot-loader-tools'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security'
compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.6.RELEASE')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-websocket'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-velocity', version: '1.1.3.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.1.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb'
compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector'
compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector'
compile group: 'org.springframework.cloud', name: 'spring-cloud-localconfig-connector'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-config', version: '2.1.3.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-dependencies', version: 'Greenwich.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.1.2.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-zuul', version: '2.1.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot', version: '2.1.6.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '5.1.8.RELEASE'
compile group: 'org.springframework', name: 'spring-context-support'
compile group: 'org.springframework.security', name: 'spring-security-core', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-config', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-data', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-web', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-messaging', version: spring_security_version
compile group: 'org.springframework.security', name: 'spring-security-acl', version: spring_security_version
compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: spring_security_oauth2_version
compile group: 'org.springframework.ws', name: 'spring-ws-core', version: '3.0.7.RELEASE'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.16'
compile group: 'com.h2database', name: 'h2'
compile group: 'org.kairosdb', name: 'client', version: '3.0.0'
compile group: 'org.projectlombok', name: 'lombok', version: lombok_version
compile group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang3_version
compile group: 'commons-validator', name: 'commons-validator', version: commons_validator_version
compile group: 'io.jsonwebtoken', name: 'jjwt', version: jjwt_version
runtime "net.java.dev.jna:jna"
optional "org.springframework.boot:spring-boot-configuration-processor"
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom 'org.springframework:spring-framework-bom:5.1.8.RELEASE'
}
}
compileJava.dependsOn(processResources)
wrapper {
gradleVersion = '5.4.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
答案 0 :(得分:0)
该错误与bval(Apache bean验证实现)有关,bval是针对目标bean验证1.0的。您可以将其升级到bval-jsr以进行bean验证1.1的实现,或者如果希望休眠,则将其排除/删除。
旁注:如果您使用的是旧版,如果我没记错的话,它需要一些system.properties调整。