我想用 undertow 替换 Tomcat。 一切看起来都很好,但当我尝试连接到 Rest api 或 vaadin 视图时,没有错误和任何其他信息表明出现问题。只有浏览器给出错误:“ERR_CONNECTION_CLOSED”
build.gradle内容:
configurations.all {
exclude group: 'org.springframework.boot', module:'spring-boot-starter-tomcat'
}
dependencies {
implementation "com.vaadin:vaadin-core:$vaadinVersion"
implementation "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
implementation("org.springframework.boot:spring-boot-starter-web:$springBootVersion") {
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.datatype'
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
exclude module: 'spring-boot-starter-tomcat'
exclude group: 'org.apache.tomcat.embed'
}
implementation("org.springframework.boot:spring-boot-starter-undertow:$springBootVersion")
implementation ("org.springframework.boot:spring-boot-starter-parent:$springBootVersion") {
// exclude module: 'spring-boot-starter-tomcat'
}
implementation "org.springframework.boot:spring-boot-starter-mail:$springBootVersion"
implementation "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
implementation("com.vaadin:vaadin-spring-boot-starter:$vaadinVersion")
implementation ("com.vaadin:vaadin-spring-boot-starter:$vaadinVersion")
implementation ("com.vaadin:vaadin-bom:${vaadinVersion}") {
exclude group: 'org.springframework.boot', module:'spring-boot-starter-tomcat'
}
implementation 'com.google.code.gson:gson:2.10.1'
implementation "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
}
控制台中没有错误或任何其他信息。无法访问 vaadin 视图和其余 api。当我切换回 tomcat 时,一切正常。 我怎样才能解决这个问题 ?我真的需要用 undertow 替换 tomcat。
我从 https://start.vaadin.com 下载了一个新项目,并更改了 build.gradle,如下所示。
更新
我还必须在 Vaadin 依赖项上排除 tomcat。
buildscript {
repositories {
mavenCentral()
maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
}
}
plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'com.vaadin'
}
repositories {
mavenCentral()
maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
maven { setUrl("https://maven.vaadin.com/vaadin-addons") }
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
implementation('com.vaadin:vaadin-spring-boot-starter') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
implementation('org.springframework.boot:spring-boot-starter-undertow')
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
dependencyManagement {
imports {
mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"
}
}