mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-05 16:59:28 +00:00
Merge branch '3.5.x' into 4.0.x
Closes gh-49672
This commit is contained in:
+1
-1
@@ -456,7 +456,7 @@ There are javadoc:org.springframework.graphql.test.tester.GraphQlTester[] varian
|
||||
|
||||
Spring Boot helps you to test your {url-spring-graphql-docs}/controllers.html[Spring GraphQL Controllers] with the javadoc:org.springframework.boot.graphql.test.autoconfigure.GraphQlTest[format=annotation] annotation from the `spring-boot-graphql-test` module.
|
||||
javadoc:org.springframework.boot.graphql.test.autoconfigure.GraphQlTest[format=annotation] auto-configures the Spring GraphQL infrastructure, without any transport nor server being involved.
|
||||
This limits scanned beans to javadoc:org.springframework.stereotype.Controller[format=annotation], javadoc:org.springframework.graphql.execution.RuntimeWiringConfigurer[], javadoc:org.springframework.boot.jackson.JacksonComponent[], javadoc:org.springframework.boot.jackson2.JsonComponent[format=annotation] (deprecated), javadoc:org.springframework.core.convert.converter.Converter[], javadoc:org.springframework.core.convert.converter.GenericConverter[], javadoc:org.springframework.graphql.execution.DataFetcherExceptionResolver[], javadoc:graphql.execution.instrumentation.Instrumentation[] and javadoc:org.springframework.boot.graphql.autoconfigure.GraphQlSourceBuilderCustomizer[].
|
||||
This limits scanned beans to javadoc:org.springframework.stereotype.Controller[format=annotation], javadoc:org.springframework.web.bind.annotation.ControllerAdvice[format=annotation], javadoc:org.springframework.graphql.execution.RuntimeWiringConfigurer[], javadoc:org.springframework.boot.jackson.JacksonComponent[], javadoc:org.springframework.boot.jackson2.JsonComponent[format=annotation] (deprecated), javadoc:org.springframework.core.convert.converter.Converter[], javadoc:org.springframework.core.convert.converter.GenericConverter[], javadoc:org.springframework.graphql.execution.DataFetcherExceptionResolver[], javadoc:graphql.execution.instrumentation.Instrumentation[] and javadoc:org.springframework.boot.graphql.autoconfigure.GraphQlSourceBuilderCustomizer[].
|
||||
Regular javadoc:org.springframework.stereotype.Component[format=annotation] and javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] beans are not scanned when the javadoc:org.springframework.boot.graphql.test.autoconfigure.GraphQlTest[format=annotation] annotation is used.
|
||||
javadoc:org.springframework.boot.context.properties.EnableConfigurationProperties[format=annotation] can be used to include javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] beans.
|
||||
|
||||
|
||||
+3
-2
@@ -46,6 +46,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
* relevant to GraphQL tests, including the following:
|
||||
* <ul>
|
||||
* <li>{@code @Controller}
|
||||
* <li>{@code @ControllerAdvice}
|
||||
* <li>{@code RuntimeWiringConfigurer}
|
||||
* <li>{@code @JacksonComponent}
|
||||
* <li>{@code @JsonComponent} (deprecated)
|
||||
@@ -122,8 +123,8 @@ public @interface GraphQlTest {
|
||||
* Determines if default filtering should be used with
|
||||
* {@link SpringBootApplication @SpringBootApplication}. By default, only
|
||||
* {@code @Controller} (when no explicit {@link #controllers() controllers} are
|
||||
* defined), {@code RuntimeWiringConfigurer}, {@code @JacksonComponent},
|
||||
* {@code @JsonComponent} (deprecated), {@code Converter}, {@code GenericConverter},
|
||||
* defined), {@code ControllerAdvice}, {@code RuntimeWiringConfigurer},
|
||||
* {@code @JacksonComponent}, {@code @JsonComponent} (deprecated), {@code Converter}, {@code GenericConverter},
|
||||
* {@code DataFetcherExceptionResolver}, {@code Instrumentation} and
|
||||
* {@code GraphQlSourceBuilderCustomizer} beans are included.
|
||||
* @see #includeFilters()
|
||||
|
||||
+2
@@ -34,6 +34,7 @@ import org.springframework.graphql.execution.RuntimeWiringConfigurer;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
|
||||
/**
|
||||
* {@link TypeExcludeFilter} for {@link GraphQlTest @GraphQlTest}.
|
||||
@@ -51,6 +52,7 @@ class GraphQlTypeExcludeFilter extends StandardAnnotationCustomizableTypeExclude
|
||||
|
||||
static {
|
||||
Set<Class<?>> includes = new LinkedHashSet<>();
|
||||
includes.add(ControllerAdvice.class);
|
||||
includes.add(JacksonComponent.class);
|
||||
includes.add(RuntimeWiringConfigurer.class);
|
||||
includes.add(Converter.class);
|
||||
|
||||
+11
@@ -42,6 +42,7 @@ import org.springframework.graphql.server.WebGraphQlResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -59,6 +60,7 @@ class GraphQlTypeExcludeFilterTests {
|
||||
GraphQlTypeExcludeFilter filter = new GraphQlTypeExcludeFilter(WithNoControllers.class);
|
||||
assertThat(excludes(filter, Controller1.class)).isFalse();
|
||||
assertThat(excludes(filter, Controller2.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleControllerAdvice.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleRuntimeWiringConfigurer.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleService.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
|
||||
@@ -74,6 +76,7 @@ class GraphQlTypeExcludeFilterTests {
|
||||
GraphQlTypeExcludeFilter filter = new GraphQlTypeExcludeFilter(WithController.class);
|
||||
assertThat(excludes(filter, Controller1.class)).isFalse();
|
||||
assertThat(excludes(filter, Controller2.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleControllerAdvice.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleRuntimeWiringConfigurer.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleService.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
|
||||
@@ -89,6 +92,7 @@ class GraphQlTypeExcludeFilterTests {
|
||||
GraphQlTypeExcludeFilter filter = new GraphQlTypeExcludeFilter(NotUsingDefaultFilters.class);
|
||||
assertThat(excludes(filter, Controller1.class)).isTrue();
|
||||
assertThat(excludes(filter, Controller2.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleControllerAdvice.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRuntimeWiringConfigurer.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleService.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
|
||||
@@ -104,6 +108,7 @@ class GraphQlTypeExcludeFilterTests {
|
||||
GraphQlTypeExcludeFilter filter = new GraphQlTypeExcludeFilter(WithIncludeFilter.class);
|
||||
assertThat(excludes(filter, Controller1.class)).isFalse();
|
||||
assertThat(excludes(filter, Controller2.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleControllerAdvice.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleRuntimeWiringConfigurer.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleService.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRepository.class)).isFalse();
|
||||
@@ -119,6 +124,7 @@ class GraphQlTypeExcludeFilterTests {
|
||||
GraphQlTypeExcludeFilter filter = new GraphQlTypeExcludeFilter(WithExcludeFilter.class);
|
||||
assertThat(excludes(filter, Controller1.class)).isTrue();
|
||||
assertThat(excludes(filter, Controller2.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleControllerAdvice.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleRuntimeWiringConfigurer.class)).isFalse();
|
||||
assertThat(excludes(filter, ExampleService.class)).isTrue();
|
||||
assertThat(excludes(filter, ExampleRepository.class)).isTrue();
|
||||
@@ -169,6 +175,11 @@ class GraphQlTypeExcludeFilterTests {
|
||||
|
||||
}
|
||||
|
||||
@ControllerAdvice
|
||||
static class ExampleControllerAdvice {
|
||||
|
||||
}
|
||||
|
||||
@Service
|
||||
static class ExampleService {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user