org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class 无法打开,因为它不存在

org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class cannot be opened because it does not exist

我的 gradle 配置具有以下依赖项:

plugins {
    id 'org.springframework.boot' version '2.6.4'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = '......'
version = '0.0.1'
sourceCompatibility = '11'

ext {
    set('springCloudVersion', "2021.0.1")
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
    implementation 'org.springframework.cloud:spring-cloud-starter-loadbalancer'
    implementation 'org.codehaus.jettison:jettison:1.4.1'
    implementation 'com.netflix.eureka:eureka-core'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'javax.validation:validation-api'
    implementation 'org.hibernate.validator:hibernate-validator'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.threeten:threetenbp:1.5.1'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'joda-time:joda-time:2.10.13'
    implementation 'org.springframework.security:spring-security-core'
    implementation 'org.apache.commons:commons-lang3:3.8.1'
    implementation 'org.apache.commons:commons-collections4:4.4'
    implementation 'org.json:json:20211205'
    implementation 'org.springframework.boot:spring-boot-starter-hateoas'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.13.1'
    implementation 'org.springframework.amqp:spring-amqp'
    implementation 'org.springframework.amqp:spring-rabbit'
    implementation 'io.jsonwebtoken:jjwt:0.9.1'
    implementation 'org.parboiled:parboiled-core:1.4.0'
    implementation 'commons-validator:commons-validator:1.7'
    implementation 'com.google.code.gson:gson:2.9.0'
    implementation 'org.springframework:spring-oxm'
    implementation 'org.springframework.ws:spring-ws-core'
    
    compileOnly 'org.projectlombok:lombok:1.18.22'
    annotationProcessor 'org.projectlombok:lombok:1.18.22'
    testCompileOnly 'org.projectlombok:lombok:1.18.22'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
    runtimeOnly 'org.postgresql:postgresql'

    implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'

    implementation 'org.liquibase:liquibase-core'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}

当我启动应用程序时出现此错误:

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist

你知道应该添加什么依赖或者缺少一些依赖吗?

P.S

问题来自此依赖项:

implementation 'org.springframework.cloud:spring-cloud-starter-hystrix:1.4.7.RELEASE'
implementation group: 'com.netflix.hystrix', name: 'hystrix-core', version: '1.5.18'

你知道我该如何解决吗?

我想你的问题已经得到解答;请考虑查看此 .

您需要包含 following dependency:

implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.10.RELEASE'

因为您正在使用 Spring BOM,也许这就足够了:

implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'