Move `DisableReactorResourceFactory...` to spring-boot-test
Move `DisableReactorResourceFactoryGlobalResources...` support from `spring-boot-web-server-test` back to `spring-boot-test` since it's useful if Reactor Netty is being used directly and removes the need for the `spring-boot-web-server-test` dependency. See gh-46356 See gh-47322
This commit is contained in:
parent
7c8a15629b
commit
82795f9966
|
@ -33,6 +33,7 @@ dependencies {
|
|||
optional("jakarta.json.bind:jakarta.json.bind-api")
|
||||
optional("jakarta.servlet:jakarta.servlet-api")
|
||||
optional("junit:junit")
|
||||
optional("io.projectreactor.netty:reactor-netty-http")
|
||||
optional("org.assertj:assertj-core")
|
||||
optional("org.hamcrest:hamcrest-core")
|
||||
optional("org.hamcrest:hamcrest-library")
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.server.test.reactor.netty;
|
||||
package org.springframework.boot.test.http.client;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.server.test.reactor.netty;
|
||||
package org.springframework.boot.test.http.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -36,12 +36,16 @@ import org.springframework.util.ClassUtils;
|
|||
*/
|
||||
class DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory implements ContextCustomizerFactory {
|
||||
|
||||
String REACTOR_RESOURCE_FACTORY_CLASS = "org.springframework.http.client.ReactorResourceFactory";
|
||||
private static final String REACTOR_RESOURCE_FACTORY_CLASS = "org.springframework.http.client.ReactorResourceFactory";
|
||||
|
||||
private static final String REACTOR_NETTY_CLASS = "reactor.netty.ReactorNetty";
|
||||
|
||||
@Override
|
||||
public @Nullable ContextCustomizer createContextCustomizer(Class<?> testClass,
|
||||
List<ContextConfigurationAttributes> configAttributes) {
|
||||
if (ClassUtils.isPresent(this.REACTOR_RESOURCE_FACTORY_CLASS, testClass.getClassLoader())) {
|
||||
ClassLoader classLoader = testClass.getClassLoader();
|
||||
if (ClassUtils.isPresent(REACTOR_RESOURCE_FACTORY_CLASS, classLoader)
|
||||
&& ClassUtils.isPresent(REACTOR_NETTY_CLASS, classLoader)) {
|
||||
return new DisableReactorResourceFactoryGlobalResourcesContextCustomizerCustomizer();
|
||||
}
|
||||
return null;
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Spring Boot support for testing Reactor Netty.
|
||||
* Spring Boot support for HTTP client testing.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.boot.web.server.test.reactor.netty;
|
||||
package org.springframework.boot.test.http.client;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
|
@ -4,6 +4,7 @@ org.springframework.boot.test.context.ImportsContextCustomizerFactory,\
|
|||
org.springframework.boot.test.context.PropertyMappingContextCustomizerFactory,\
|
||||
org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\
|
||||
org.springframework.boot.test.context.filter.annotation.TypeExcludeFiltersContextCustomizerFactory,\
|
||||
org.springframework.boot.test.http.client.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory,\
|
||||
org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory,\
|
||||
org.springframework.boot.test.web.reactive.client.WebTestClientContextCustomizerFactory,\
|
||||
org.springframework.boot.test.web.servlet.client.RestTestClientContextCustomizerFactory
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.server.test.reactor.netty;
|
||||
package org.springframework.boot.test.http.client;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
# Environment Post Processors
|
||||
org.springframework.boot.EnvironmentPostProcessor=\
|
||||
org.springframework.boot.web.server.test.SpringBootTestRandomPortEnvironmentPostProcessor
|
||||
|
||||
# Spring Test Context Customizer Factories
|
||||
org.springframework.test.context.ContextCustomizerFactory=\
|
||||
org.springframework.boot.web.server.test.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory
|
||||
|
|
Loading…
Reference in New Issue