Create spring-boot-websocket module

This commit is contained in:
Andy Wilkinson
2025-04-29 11:24:54 +01:00
committed by Phillip Webb
parent 2c0e8b7900
commit 6bf5e0c1d7
10 changed files with 38 additions and 11 deletions

View File

@@ -145,6 +145,7 @@ include "spring-boot-project:spring-boot-validation"
include "spring-boot-project:spring-boot-webflux"
include "spring-boot-project:spring-boot-webmvc"
include "spring-boot-project:spring-boot-webservices"
include "spring-boot-project:spring-boot-websocket"
include "spring-boot-system-tests:spring-boot-deployment-tests"
include "spring-boot-system-tests:spring-boot-image-tests"
include "spring-boot-tests:spring-boot-integration-tests:spring-boot-configuration-processor-tests"

View File

@@ -9,4 +9,3 @@ org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpCo
org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration
org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration

View File

@@ -2115,7 +2115,8 @@ bom {
"spring-boot-undertow",
"spring-boot-validation",
"spring-boot-webflux",
"spring-boot-webmvc"
"spring-boot-webmvc",
"spring-boot-websocket"
]
plugins = [
"spring-boot-maven-plugin"

View File

@@ -135,6 +135,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-webflux", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-webmvc", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-webservices", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-websocket", configuration: "autoConfigurationMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-activemq", configuration: "configurationPropertiesMetadata"))

View File

@@ -6,6 +6,5 @@ description = "Starter for building WebSocket applications using Spring Framewor
dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
api("org.springframework:spring-messaging")
api("org.springframework:spring-websocket")
api(project(":spring-boot-project:spring-boot-websocket"))
}

View File

@@ -0,0 +1,25 @@
plugins {
id "java-library"
id "org.springframework.boot.auto-configuration"
id "org.springframework.boot.deployed"
id "org.springframework.boot.optional-dependencies"
}
description = "Spring Boot WebSocket"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.springframework:spring-messaging")
api("org.springframework:spring-websocket")
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-jackson"))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(project(":spring-boot-project:spring-boot-webmvc"))
testImplementation("org.apache.tomcat.embed:tomcat-embed-websocket")
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.websocket.servlet;
package org.springframework.boot.websocket.autoconfigure.servlet;
import java.util.List;
import java.util.Map;
@@ -49,7 +49,7 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
* @author Andy Wilkinson
* @author Lasse Wulff
* @author Moritz Halbritter
* @since 1.3.0
* @since 4.0.0
*/
@AutoConfiguration(afterName = "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration")
@ConditionalOnWebApplication(type = Type.SERVLET)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,4 +17,4 @@
/**
* Auto-configuration for WebSocket support in servlet web servers.
*/
package org.springframework.boot.autoconfigure.websocket.servlet;
package org.springframework.boot.websocket.autoconfigure.servlet;

View File

@@ -0,0 +1 @@
org.springframework.boot.websocket.autoconfigure.servlet.WebSocketMessagingAutoConfiguration

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.websocket.servlet;
package org.springframework.boot.websocket.autoconfigure.servlet;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -38,7 +38,6 @@ import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.boot.LazyInitializationBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
import org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues;
@@ -47,6 +46,7 @@ import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebSer
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration;
import org.springframework.boot.websocket.autoconfigure.servlet.WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
@@ -146,7 +146,7 @@ class WebSocketMessagingAutoConfigurationTests {
void predefinedThreadExecutorIsSelectedForInboundChannel() {
AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor();
ChannelRegistration registration = new ChannelRegistration();
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration(
WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration(
new ObjectMapper(),
Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor));
configuration.configureClientInboundChannel(registration);