我想替换 Vaadin 中的 Tomcat。想用 Under / Jetty / Netty 替换它。 目前我正在使用 spring boot 并用 undertow 替换 tomcat 。不幸的是,此设置禁用了 Vaadin 中的 WEB_PUSH。有没有办法解决 ?或者也许是替换 vaadin 内的 tomcat 的方法?或者让 vaadin webpush 与 undertow / netty / jetty 一起工作? 我真的需要一些更轻的东西。 Tomcat很重。
Tomcat 不在 Vaadin 内部,而是在 Spring Boot 中。您可以使用 Spring Boot 参考手册中的说明将 Tomcat 替换为例如潜流。并不是说 spring-boot-starter-web 依赖项不一定直接在您的 pom.xml 中,而是由 Vaadin 依赖项传递引入。我尝试将以下代码片段添加到基本的 Vaadin 24.1 项目中,之后使用 Undertow 而不是 Tomcat,并且服务器推送对我来说效果很好:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- Exclude the Tomcat dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>