WebSockets

Spring Boot 为嵌入式 Tomcat 和 Jetty 提供了 WebSockets 自动配置。如果您将 war 文件部署到独立容器,Spring Boot 假定容器负责配置其 WebSocket 支持。

Spring Framework 为 MVC Web 应用程序提供了丰富的 WebSocket 支持,可以通过 spring-boot-starter-websocket 模块轻松访问。

WebSocket 支持也适用于响应式 Web 应用程序,并且需要与 spring-boot-starter-webflux 一起包含 WebSocket API。

<dependency>
	<groupId>jakarta.websocket</groupId>
	<artifactId>jakarta.websocket-api</artifactId>
</dependency>
© . This site is unofficial and not affiliated with VMware.