Create spring-boot-webservices module
This commit is contained in:
committed by
Phillip Webb
parent
8579f0014f
commit
10db864d35
@@ -121,6 +121,7 @@ include "spring-boot-project:spring-boot-tx"
|
||||
include "spring-boot-project:spring-boot-undertow"
|
||||
include "spring-boot-project:spring-boot-validation"
|
||||
include "spring-boot-project:spring-boot-webmvc"
|
||||
include "spring-boot-project:spring-boot-webservices"
|
||||
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,141 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.webservices.client;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.http.client.JdkClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.ssl.SslBundle;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
|
||||
/**
|
||||
* {@link WebServiceMessageSender} builder that can detect a suitable HTTP library based
|
||||
* on the classpath.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.1.0
|
||||
* @deprecated since 3.4.0 in favor of
|
||||
* {@link WebServiceMessageSenderFactory#http(ClientHttpRequestFactorySettings)}
|
||||
*/
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
public class HttpWebServiceMessageSenderBuilder {
|
||||
|
||||
private ClientHttpRequestFactoryBuilder<?> requestFactoryBuilder;
|
||||
|
||||
private ClientHttpRequestFactorySettings requestFactorySettings = ClientHttpRequestFactorySettings.defaults();
|
||||
|
||||
/**
|
||||
* Set the connection timeout.
|
||||
* @param connectTimeout the connection timeout
|
||||
* @return the current builder instance
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder setConnectTimeout(Duration connectTimeout) {
|
||||
this.requestFactorySettings = this.requestFactorySettings.withConnectTimeout(connectTimeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the read timeout.
|
||||
* @param readTimeout the read timeout
|
||||
* @return the current builder instance
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder setReadTimeout(Duration readTimeout) {
|
||||
this.requestFactorySettings = this.requestFactorySettings.withReadTimeout(readTimeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an {@link SslBundle} that will be used to configure a secure connection.
|
||||
* @param sslBundle the SSL bundle
|
||||
* @return the current builder instance
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder sslBundle(SslBundle sslBundle) {
|
||||
this.requestFactorySettings = this.requestFactorySettings.withSslBundle(sslBundle);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code Supplier} of {@link ClientHttpRequestFactory} that should be called
|
||||
* to create the HTTP-based {@link WebServiceMessageSender}.
|
||||
* @param requestFactorySupplier the supplier for the request factory
|
||||
* @return the current builder instance
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder requestFactory(
|
||||
Supplier<ClientHttpRequestFactory> requestFactorySupplier) {
|
||||
Assert.notNull(requestFactorySupplier, "'requestFactorySupplier' must not be null");
|
||||
this.requestFactoryBuilder = ClientHttpRequestFactoryBuilder.of(requestFactorySupplier);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@code Function} of {@link ClientHttpRequestFactorySettings} to
|
||||
* {@link ClientHttpRequestFactory} that should be called to create the HTTP-based
|
||||
* {@link WebServiceMessageSender}.
|
||||
* @param requestFactoryFunction the function for the request factory
|
||||
* @return the current builder instance
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder requestFactory(
|
||||
Function<ClientHttpRequestFactorySettings, ClientHttpRequestFactory> requestFactoryFunction) {
|
||||
Assert.notNull(requestFactoryFunction, "'requestFactoryFunction' must not be null");
|
||||
this.requestFactoryBuilder = requestFactoryFunction::apply;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link ClientHttpRequestFactoryBuilder} to use when creating the HTTP-based
|
||||
* {@link WebServiceMessageSender}.
|
||||
* @param requestFactoryBuilder the {@link ClientHttpRequestFactoryBuilder} to use
|
||||
* @return this builder instance
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public HttpWebServiceMessageSenderBuilder requestFactoryBuilder(
|
||||
ClientHttpRequestFactoryBuilder<?> requestFactoryBuilder) {
|
||||
Assert.notNull(requestFactoryBuilder, "'requestFactoryBuilder' must not be null");
|
||||
this.requestFactoryBuilder = requestFactoryBuilder;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the {@link WebServiceMessageSender} instance.
|
||||
* @return the {@link WebServiceMessageSender} instance
|
||||
*/
|
||||
public WebServiceMessageSender build() {
|
||||
ClientHttpRequestFactoryBuilder<?> requestFactoryBuilder = getOrDetectRequestFactoryBuilder();
|
||||
return WebServiceMessageSenderFactory.http(requestFactoryBuilder, this.requestFactorySettings)
|
||||
.getWebServiceMessageSender();
|
||||
}
|
||||
|
||||
private ClientHttpRequestFactoryBuilder<?> getOrDetectRequestFactoryBuilder() {
|
||||
if (this.requestFactoryBuilder != null) {
|
||||
return this.requestFactoryBuilder;
|
||||
}
|
||||
ClientHttpRequestFactoryBuilder<?> builder = ClientHttpRequestFactoryBuilder.detect();
|
||||
if (builder instanceof JdkClientHttpRequestFactoryBuilder) {
|
||||
// Same logic as earlier versions which did not support JDK client factories
|
||||
return ClientHttpRequestFactoryBuilder.simple();
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2024 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.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.webservices.client;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.JettyClientHttpRequestFactory;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
import org.springframework.ws.transport.http.ClientHttpRequestMessageSender;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link HttpWebServiceMessageSenderBuilder} when Http Components is not
|
||||
* available and, therefore, Jetty's client is used instead.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @deprecated since 3.4.0 for removal in 4.0.0
|
||||
*/
|
||||
@ClassPathExclusions("httpclient5-*.jar")
|
||||
@SuppressWarnings("removal")
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
class HttpWebServiceMessageSenderBuilderJettyClientIntegrationTests {
|
||||
|
||||
private final HttpWebServiceMessageSenderBuilder builder = new HttpWebServiceMessageSenderBuilder();
|
||||
|
||||
@Test
|
||||
void buildUseJettyClientIfHttpComponentsIsNotAvailable() {
|
||||
WebServiceMessageSender messageSender = this.builder.build();
|
||||
assertJettyClientHttpRequestFactory(messageSender);
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildWithCustomTimeouts() {
|
||||
WebServiceMessageSender messageSender = this.builder.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(2))
|
||||
.build();
|
||||
JettyClientHttpRequestFactory factory = assertJettyClientHttpRequestFactory(messageSender);
|
||||
HttpClient client = (HttpClient) ReflectionTestUtils.getField(factory, "httpClient");
|
||||
assertThat(client).isNotNull();
|
||||
assertThat(client.getConnectTimeout()).isEqualTo(5000);
|
||||
assertThat(factory).hasFieldOrPropertyWithValue("readTimeout", 2000L);
|
||||
}
|
||||
|
||||
private JettyClientHttpRequestFactory assertJettyClientHttpRequestFactory(WebServiceMessageSender messageSender) {
|
||||
assertThat(messageSender).isInstanceOf(ClientHttpRequestMessageSender.class);
|
||||
ClientHttpRequestMessageSender sender = (ClientHttpRequestMessageSender) messageSender;
|
||||
ClientHttpRequestFactory requestFactory = sender.getRequestFactory();
|
||||
assertThat(requestFactory).isInstanceOf(JettyClientHttpRequestFactory.class);
|
||||
return (JettyClientHttpRequestFactory) requestFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2024 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.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.webservices.client;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import io.netty.channel.ChannelOption;
|
||||
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ReactorClientHttpRequestFactory;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
import org.springframework.ws.transport.http.ClientHttpRequestMessageSender;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link HttpWebServiceMessageSenderBuilder} when Reactor Netty is the
|
||||
* predominant HTTP client.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @deprecated since 3.4.0 for removal in 4.0.0
|
||||
*/
|
||||
@ClassPathExclusions({ "httpclient5-*.jar", "jetty-client-*.jar" })
|
||||
@SuppressWarnings("removal")
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
class HttpWebServiceMessageSenderBuilderReactorClientIntegrationTests {
|
||||
|
||||
private final HttpWebServiceMessageSenderBuilder builder = new HttpWebServiceMessageSenderBuilder();
|
||||
|
||||
@Test
|
||||
void buildUsesReactorClientIfHttpComponentsAndJettyAreNotAvailable() {
|
||||
WebServiceMessageSender messageSender = this.builder.build();
|
||||
assertReactorClientHttpRequestFactory(messageSender);
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildWithCustomTimeouts() {
|
||||
WebServiceMessageSender messageSender = this.builder.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(2))
|
||||
.build();
|
||||
ReactorClientHttpRequestFactory factory = assertReactorClientHttpRequestFactory(messageSender);
|
||||
assertThat(factory).extracting("httpClient", InstanceOfAssertFactories.type(HttpClient.class))
|
||||
.extracting((httpClient) -> httpClient.configuration().options(), InstanceOfAssertFactories.MAP)
|
||||
.containsEntry(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000);
|
||||
assertThat(factory).hasFieldOrPropertyWithValue("readTimeout", Duration.ofSeconds(2));
|
||||
}
|
||||
|
||||
private ReactorClientHttpRequestFactory assertReactorClientHttpRequestFactory(
|
||||
WebServiceMessageSender messageSender) {
|
||||
assertThat(messageSender).isInstanceOf(ClientHttpRequestMessageSender.class);
|
||||
ClientHttpRequestMessageSender sender = (ClientHttpRequestMessageSender) messageSender;
|
||||
ClientHttpRequestFactory requestFactory = sender.getRequestFactory();
|
||||
assertThat(requestFactory).isInstanceOf(ReactorClientHttpRequestFactory.class);
|
||||
return (ReactorClientHttpRequestFactory) requestFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2024 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.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.webservices.client;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
import org.springframework.ws.transport.http.ClientHttpRequestMessageSender;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link HttpWebServiceMessageSenderBuilder} when no preferred HTTP clients are
|
||||
* available
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @deprecated since 3.4.0 for removal in 4.0.0
|
||||
*/
|
||||
@ClassPathExclusions({ "httpclient5-*.jar", "jetty-client-*.jar", "reactor-netty-http-*.jar" })
|
||||
@SuppressWarnings("removal")
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
class HttpWebServiceMessageSenderBuilderSimpleIntegrationTests {
|
||||
|
||||
private final HttpWebServiceMessageSenderBuilder builder = new HttpWebServiceMessageSenderBuilder();
|
||||
|
||||
@Test
|
||||
void buildUseUseSimpleClientByDefault() {
|
||||
WebServiceMessageSender messageSender = this.builder.build();
|
||||
assertSimpleClientRequestFactory(messageSender);
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildWithCustomTimeouts() {
|
||||
WebServiceMessageSender messageSender = this.builder.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(2))
|
||||
.build();
|
||||
SimpleClientHttpRequestFactory requestFactory = assertSimpleClientRequestFactory(messageSender);
|
||||
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 5000);
|
||||
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 2000);
|
||||
}
|
||||
|
||||
private SimpleClientHttpRequestFactory assertSimpleClientRequestFactory(WebServiceMessageSender messageSender) {
|
||||
assertThat(messageSender).isInstanceOf(ClientHttpRequestMessageSender.class);
|
||||
ClientHttpRequestMessageSender sender = (ClientHttpRequestMessageSender) messageSender;
|
||||
ClientHttpRequestFactory requestFactory = sender.getRequestFactory();
|
||||
assertThat(requestFactory).isInstanceOf(SimpleClientHttpRequestFactory.class);
|
||||
return (SimpleClientHttpRequestFactory) requestFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2024 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.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.webservices.client;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
import org.springframework.ws.transport.http.ClientHttpRequestMessageSender;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Tests for {@link HttpWebServiceMessageSenderBuilder}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @deprecated since 3.4.0 for removal in 4.0.0
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||
class HttpWebServiceMessageSenderBuilderTests {
|
||||
|
||||
@Test
|
||||
void buildWithRequestFactorySupplier() {
|
||||
ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class);
|
||||
ClientHttpRequestMessageSender messageSender = build(
|
||||
new HttpWebServiceMessageSenderBuilder().requestFactory(() -> requestFactory));
|
||||
assertThat(messageSender.getRequestFactory()).isSameAs(requestFactory);
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildWithReadAndConnectTimeout() {
|
||||
ClientHttpRequestMessageSender messageSender = build(
|
||||
new HttpWebServiceMessageSenderBuilder().requestFactory(SimpleClientHttpRequestFactory::new)
|
||||
.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(2)));
|
||||
SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) messageSender
|
||||
.getRequestFactory();
|
||||
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 5000);
|
||||
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 2000);
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildUsesHttpComponentsByDefault() {
|
||||
ClientHttpRequestMessageSender messageSender = build(
|
||||
new HttpWebServiceMessageSenderBuilder().setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(5)));
|
||||
ClientHttpRequestFactory requestFactory = messageSender.getRequestFactory();
|
||||
assertThat(requestFactory).isInstanceOf(HttpComponentsClientHttpRequestFactory.class);
|
||||
}
|
||||
|
||||
private ClientHttpRequestMessageSender build(HttpWebServiceMessageSenderBuilder builder) {
|
||||
WebServiceMessageSender messageSender = builder.build();
|
||||
assertThat(messageSender).isInstanceOf(ClientHttpRequestMessageSender.class);
|
||||
return ((ClientHttpRequestMessageSender) messageSender);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -180,13 +180,6 @@ dependencies {
|
||||
optional("org.springframework.session:spring-session-jdbc")
|
||||
optional("org.springframework.amqp:spring-rabbit")
|
||||
optional("org.springframework.amqp:spring-rabbit-stream")
|
||||
optional("org.springframework.ws:spring-ws-core") {
|
||||
exclude group: "com.sun.mail", module: "jakarta.mail"
|
||||
exclude group: "jakarta.platform", module: "jakarta.jakartaee-api"
|
||||
exclude group: "org.eclipse.jetty", module: "jetty-server"
|
||||
exclude group: "org.eclipse.jetty", module: "jetty-servlet"
|
||||
exclude group: "jakarta.mail", module: "jakarta.mail-api"
|
||||
}
|
||||
optional("redis.clients:jedis")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-freemarker"))
|
||||
|
||||
@@ -808,11 +808,6 @@
|
||||
"reason": "Replaced by the PartEventHttpMessageReader and the PartEvent API.",
|
||||
"level": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "spring.webservices.wsdl-locations",
|
||||
"type": "java.util.List<java.lang.String>",
|
||||
"description": "Comma-separated list of locations of WSDLs and accompanying XSDs to be exposed as beans."
|
||||
}
|
||||
],
|
||||
"hints": [
|
||||
|
||||
@@ -59,5 +59,3 @@ org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAut
|
||||
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration
|
||||
|
||||
@@ -2094,7 +2094,8 @@ bom {
|
||||
"spring-boot-tx",
|
||||
"spring-boot-undertow",
|
||||
"spring-boot-validation",
|
||||
"spring-boot-webmvc"
|
||||
"spring-boot-webmvc",
|
||||
"spring-boot-webservices"
|
||||
]
|
||||
plugins = [
|
||||
"spring-boot-maven-plugin"
|
||||
|
||||
@@ -112,6 +112,7 @@ dependencies {
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-undertow", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-validation", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-webmvc", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-webservices", configuration: "autoConfigurationMetadata"))
|
||||
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-activemq", configuration: "configurationPropertiesMetadata"))
|
||||
@@ -167,6 +168,7 @@ dependencies {
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-tx", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-undertow", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-webmvc", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-webservices", configuration: "configurationPropertiesMetadata"))
|
||||
|
||||
dokkatoo(project(path: ":spring-boot-project:spring-boot-all"))
|
||||
dokkatoo(project(path: ":spring-boot-project:spring-boot-test"))
|
||||
@@ -198,6 +200,7 @@ dependencies {
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-undertow"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-webmvc"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-webservices"))
|
||||
implementation("ch.qos.logback:logback-classic")
|
||||
implementation("com.redis:testcontainers-redis")
|
||||
implementation("com.zaxxer:HikariCP")
|
||||
|
||||
@@ -6,8 +6,7 @@ description = "Starter for using Spring Web Services"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
|
||||
api(project(":spring-boot-project:spring-boot-webservices"))
|
||||
api("com.sun.xml.messaging.saaj:saaj-impl")
|
||||
api("jakarta.xml.ws:jakarta.xml.ws-api")
|
||||
api("org.springframework:spring-oxm")
|
||||
api("org.springframework.ws:spring-ws-core")
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-tx"))
|
||||
optional(project(":spring-boot-project:spring-boot-validation"))
|
||||
optional(project(":spring-boot-project:spring-boot-webmvc"))
|
||||
optional(project(":spring-boot-project:spring-boot-webservices"))
|
||||
optional("jakarta.json.bind:jakarta.json.bind-api")
|
||||
optional("jakarta.persistence:jakarta.persistence-api")
|
||||
optional("jakarta.servlet:jakarta.servlet-api")
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration;
|
||||
import org.springframework.boot.webservices.autoconfigure.client.WebServiceTemplateAutoConfiguration;
|
||||
import org.springframework.boot.webservices.client.WebServiceTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.ws.client.core.WebServiceTemplate;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# AutoConfigureWebServiceClient
|
||||
org.springframework.boot.test.autoconfigure.webservices.client.WebServiceClientTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration
|
||||
org.springframework.boot.webservices.autoconfigure.client.WebServiceTemplateAutoConfiguration
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# AutoConfigureWebServiceServer auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration
|
||||
org.springframework.boot.webservices.autoconfigure.WebServicesAutoConfiguration
|
||||
26
spring-boot-project/spring-boot-webservices/build.gradle
Normal file
26
spring-boot-project/spring-boot-webservices/build.gradle
Normal file
@@ -0,0 +1,26 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot Web Services"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot"))
|
||||
api("org.springframework:spring-oxm")
|
||||
api("org.springframework.ws:spring-ws-core")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional("jakarta.servlet:jakarta.servlet-api")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation("org.eclipse.jetty:jetty-client")
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
testRuntimeOnly("io.projectreactor.netty:reactor-netty-http")
|
||||
testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5")
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||
import org.springframework.boot.autoconfigure.condition.OnPropertyListCondition;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices.client;
|
||||
package org.springframework.boot.webservices.autoconfigure.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.webservices.client.WebServiceMessageSenderFactory;
|
||||
@@ -38,9 +37,9 @@ import org.springframework.ws.client.core.WebServiceTemplate;
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link WebServiceTemplate}.
|
||||
*
|
||||
* @author Dmytro Nosan
|
||||
* @since 2.1.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = HttpClientAutoConfiguration.class)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass({ WebServiceTemplate.class, Unmarshaller.class, Marshaller.class })
|
||||
public class WebServiceTemplateAutoConfiguration {
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for Spring Web Services Clients.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.webservices.client;
|
||||
package org.springframework.boot.webservices.autoconfigure.client;
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for Spring Web Services.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
@@ -117,7 +117,6 @@ public class WebServiceTemplateBuilder {
|
||||
* @param messageSenderFactory the {@link WebServiceMessageSenderFactory} to use
|
||||
* @return a new builder instance
|
||||
* @since 3.4.0
|
||||
* @see HttpWebServiceMessageSenderBuilder
|
||||
*/
|
||||
public WebServiceTemplateBuilder httpMessageSenderFactory(WebServiceMessageSenderFactory messageSenderFactory) {
|
||||
Assert.notNull(messageSenderFactory, "'messageSenderFactory' must not be null");
|
||||
@@ -132,7 +131,6 @@ public class WebServiceTemplateBuilder {
|
||||
* @param detectHttpMessageSender if an HTTP-based {@link WebServiceMessageSender}
|
||||
* should be detected
|
||||
* @return a new builder instance
|
||||
* @see HttpWebServiceMessageSenderBuilder
|
||||
*/
|
||||
public WebServiceTemplateBuilder detectHttpMessageSender(boolean detectHttpMessageSender) {
|
||||
return new WebServiceTemplateBuilder(this.httpMessageSenderFactory, detectHttpMessageSender, this.interceptors,
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.webservices.wsdl-locations",
|
||||
"type": "java.util.List<java.lang.String>",
|
||||
"description": "Comma-separated list of locations of WSDLs and accompanying XSDs to be exposed as beans."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.webservices.autoconfigure.WebServicesAutoConfiguration
|
||||
org.springframework.boot.webservices.autoconfigure.client.WebServiceTemplateAutoConfiguration
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices;
|
||||
package org.springframework.boot.webservices.autoconfigure;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.webservices.client;
|
||||
package org.springframework.boot.webservices.autoconfigure.client;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration;
|
||||
import org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
@@ -48,8 +47,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class WebServiceTemplateAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().withConfiguration(
|
||||
AutoConfigurations.of(WebServiceTemplateAutoConfiguration.class, HttpClientAutoConfiguration.class));
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(WebServiceTemplateAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
void autoConfiguredBuilderShouldNotHaveMarshallerAndUnmarshaller() {
|
||||
@@ -97,9 +96,8 @@ class WebServiceTemplateAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenHasFactoryProperty() {
|
||||
this.contextRunner.withConfiguration(AutoConfigurations.of(HttpMessageConvertersAutoConfiguration.class))
|
||||
.withPropertyValues("spring.http.client.factory=simple")
|
||||
void whenHasFactory() {
|
||||
this.contextRunner.withBean(ClientHttpRequestFactoryBuilder.class, ClientHttpRequestFactoryBuilder::simple)
|
||||
.run(assertWebServiceTemplateBuilder((builder) -> {
|
||||
WebServiceTemplate webServiceTemplate = builder.build();
|
||||
assertThat(webServiceTemplate.getMessageSenders()).hasSize(1);
|
||||
Reference in New Issue
Block a user