Browse Source

Create spring-boot-websocket module

Closes gh-46144
pull/46230/head
Andy Wilkinson 8 months ago
parent
commit
971acab9bb
  1. 1
      settings.gradle
  2. 1
      spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  3. 3
      spring-boot-project/spring-boot-dependencies/build.gradle
  4. 1
      spring-boot-project/spring-boot-docs/build.gradle
  5. 3
      spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/build.gradle
  6. 42
      spring-boot-project/spring-boot-websocket/build.gradle
  7. 4
      spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfiguration.java
  8. 2
      spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/package-info.java
  9. 1
      spring-boot-project/spring-boot-websocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  10. 6
      spring-boot-project/spring-boot-websocket/src/test/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfigurationTests.java

1
settings.gradle

@ -161,6 +161,7 @@ include "spring-boot-project:spring-boot-validation" @@ -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"

1
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 @@ -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

3
spring-boot-project/spring-boot-dependencies/build.gradle

@ -2126,7 +2126,8 @@ bom { @@ -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"

1
spring-boot-project/spring-boot-docs/build.gradle

@ -151,6 +151,7 @@ dependencies { @@ -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"))

3
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 @@ -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"))
}

42
spring-boot-project/spring-boot-websocket/build.gradle

@ -0,0 +1,42 @@ @@ -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")
}

4
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfiguration.java → spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfiguration.java

@ -14,7 +14,7 @@ @@ -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 @@ -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)

2
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/package-info.java → spring-boot-project/spring-boot-websocket/src/main/java/org/springframework/boot/websocket/autoconfigure/servlet/package-info.java

@ -17,4 +17,4 @@ @@ -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;

1
spring-boot-project/spring-boot-websocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

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

6
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/websocket/servlet/WebSocketMessagingAutoConfigurationTests.java → spring-boot-project/spring-boot-websocket/src/test/java/org/springframework/boot/websocket/autoconfigure/servlet/WebSocketMessagingAutoConfigurationTests.java

@ -14,7 +14,7 @@ @@ -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; @@ -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 @@ -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 { @@ -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);
Loading…
Cancel
Save