在我的 SpringBoot 应用程序日志中,我看到以下警告:
UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
从 Google 搜索看来,它们可能与 Undertow 建议的改进有关,但似乎无法实施。
有人对这些有任何进一步的说明吗,也许还有关于如何使日志消失的建议,因为应用程序运行得很好?
这是buff池配置的提醒,不影响使用。
根据https://blog.csdn.net/weixin_39841589/article/details/90582354的建议,
@Component
public class CustomizationBean implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addDeploymentInfoCustomizers(deploymentInfo -> {
WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024));
deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo);
});
}
}
如果您不需要网络套接字,则可以排除它们,这将使该消息消失:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<exclusions>
<!-- Exclude web sockets -->
<exclusion>
<artifactId>undertow-websockets-jsr</artifactId>
<groupId>io.undertow</groupId>
</exclusion>
</exclusions>
</dependency>
如果在 SpringBoot 上的 Undertow 中不使用 WebSocket。
implementation ("org.springframework.boot:spring-boot-starter-undertow") {
exclude group: "io.undertow", module: "undertow-websockets-jsr"
}