spring 带底流启动

spring boot with undertow

我正在尝试 运行 undertow 作为我的 spring 启动应用程序中的 servlet 容器,我遵循了我发现的所有相关说明,但仍然从日志中可以看出 tomcat 是网络服务器。

这是日志:

21-03-17 00:15:45.481 INFO [] [restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat 初始化端口: 8080 (http)

2021-03-17 00:15:45.489 INFO [] [restartedMain] o.apache.catalina.core.StandardService:启动服务 [Tomcat]

2021-03-17 00:15:45.489 INFO [] [restartedMain] org.apache.catalina.core.StandardEngine:正在启动 Servlet 引擎:[Apache Tomcat/9.0.43]

这是我的 build.gradle 文件:

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.4.3'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'jacoco'
    id "com.github.spotbugs" version "4.6.0"
    id "com.github.node-gradle.node" version "2.2.4"
}

jacoco {
    toolVersion = "0.8.6"
}
spotbugs {
    ignoreFailures = true
}
jacocoTestReport {
    reports {
        xml.enabled true
        csv.enabled true
        html.enabled true
    }
}
spotbugsMain {
    reports {
        html.enabled = true
        xml.enabled = true
    }
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
    mavenLocal()
    mavenCentral()
}


sourceSets {
    componentTest {
        java {
            srcDir file('src/componentTest/java')
        }
        resources.srcDir file('src/componentTest/resources')
    }
}

configurations {
    componentTestCompile.extendsFrom testCompile
    componentTestRuntime.extendsFrom testRuntime
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }

}
dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2020.0.1'
    }
}

dependencies {
    implementation 'com.imperva:ms-spring-connector:1.2.6'
    implementation group: 'net.rakugakibox.spring.boot', name: 'logback-access-spring-boot-starter', version: '2.7.1'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    compile("org.springframework.boot:spring-boot-starter-web") {
        exclude module: "spring-boot-starter-tomcat"
    }
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-undertow'
    implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth'
    implementation 'io.micrometer:micrometer-registry-prometheus'
    implementation 'io.micrometer:micrometer-core'



    compileOnly 'org.projectlombok:lombok:1.18.16'
    annotationProcessor 'org.projectlombok:lombok:1.18.16'

    developmentOnly 'org.springframework.boot:spring-boot-devtools'

    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }

    // Component Tests:
    componentTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
    componentTestImplementation group:   'com.imperva', name: 'jwt-generator', version: '1.4.0'
    componentTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
    componentTestImplementation group: 'com.imperva', name: 'imperva-test-containers', 'version': '2.0.1'
    componentTestImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
    componentTestImplementation group: 'com.epam.reportportal', name: 'logger-java-logback', version: '4.0.0'
    componentTestImplementation 'com.epam.reportportal:agent-java-junit5:4.0.1'
    componentTestImplementation group: 'com.incapsula', name: 'jwt-utils', 'version': '3.3.1'
    componentTestImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'

}

task componentTest(type: Test) {
    testClassesDirs = sourceSets.componentTest.output.classesDirs
    classpath = sourceSets.componentTest.runtimeClasspath
    outputs.upToDateWhen { false }
    group = 'verification'
    useJUnitPlatform()
    systemProperty 'junit.jupiter.extensions.autodetection.enabled', true
}

test {
    useJUnitPlatform()
    finalizedBy jacocoTestReport
}

请指教。我 运行 脑洞大开。

谢谢

问题的原因是这个依赖: 实施组:'net.rakugakibox.spring.boot',名称:'logback-access-spring-boot-starter',版本:'2.7.1'