diff --git a/settings.gradle b/settings.gradle index 3982722f9b0..fb55995ffda 100644 --- a/settings.gradle +++ b/settings.gradle @@ -161,6 +161,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" diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 7b41c7d7a67..b7a733f8cc6 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -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 diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 6ca08eded95..38d88810e35 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -2126,7 +2126,8 @@ bom { "spring-boot-validation", "spring-boot-webflux", "spring-boot-webmvc", - "spring-boot-webservices" + "spring-boot-webservices", + "spring-boot-websocket" ] plugins = [ "spring-boot-maven-plugin" diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 2ab8e101c31..45950d8696d 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -151,6 +151,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")) diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/build.gradle index 6b3af5e6068..63aaba4aa3a 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/build.gradle @@ -22,6 +22,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")) } diff --git a/spring-boot-project/spring-boot-websocket/build.gradle b/spring-boot-project/spring-boot-websocket/build.gradle new file mode 100644 index 00000000000..e84f82ba41c --- /dev/null +++ b/spring-boot-project/spring-boot-websocket/build.gradle @@ -0,0 +1,42 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +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") +} diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java b/spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfiguration.java similarity index 98% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java rename to spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfiguration.java index 0999a8b7528..fdade17c263 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java +++ b/spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfiguration.java @@ -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) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/package-info.java b/spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/package-info.java similarity index 91% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/package-info.java rename to spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/package-info.java index 497bf89b328..db0507aa846 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/package-info.java +++ b/spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/package-info.java @@ -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; diff --git a/spring-boot-project/spring-boot-websocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-websocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000000..85617d3fddb --- /dev/null +++ b/spring-boot-project/spring-boot-websocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.boot.websocket.autoconfigure.servlet.WebSocketMessagingAutoConfiguration diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-project/spring-boot-websocket/src/test/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfigurationTests.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java rename to spring-boot-project/spring-boot-websocket/src/test/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfigurationTests.java index 4c165d21ec7..f9ea65ca8e5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-websocket/src/test/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfigurationTests.java @@ -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);