This commit adapts to the latest Spring GraphQL changes, renaming
`GraphQlService` to `ExecutionGraphQlService` as well as the
`WebInterceptor` contract to `WebGraphQlHandlerInterceptor`.
See spring-projects/spring-graphql#332
Ensure that the `spring.jmx.unique-names` property is applied to the
auto-configured `MBeanExporter` as well as the `ObjectNamingStrategy`.
Fixes gh-29968
As part of the upgrade, the property for configuring features has
been removed as support for feature-aware versions has been removed
from Embedded Mongo. For advanced configuration where features were
specified, users should provide a MongodConfig bean instead.
Closes gh-29985
Closes gh-30219
Prior to this commit, launching a GraphQL application without any schema
file or customizer bean would result in an exception caught by a
FailureAnalyzer telling the developer about configured locations.
Since then, a new client has been introduced in Spring GraphQL and the
mere presence of the GraphQL starter does not mean anymore that the
intent is to create a GraphQL API in the app: we could instead just
consume an existing, remote API.
This commit refines the GraphQL server auto-configuration so that it is
enabled only if:
* there is at least one schema file in the configured locations
* or a `GraphQlSourceCustomizer` bean has been defined in the app
These changes make the custom FailureAnalyzer useless and is also
removed as part of this commit.
Closes gh-30035
Prior to this commit, we would configure a default conversion service
for GraphQL annotated controllers, without registering any additional
formatters.
This commit aligns the GraphQL auto-configuration with MVC and WebFlux,
since we now use the `ApplicationConversionService` to register all
application formatters for the GraphQL infrastructure.
Closes gh-29638
After 0b449d89e1,
the ConversionService on AnnotatedControllerConfigurer is an internally
managed instance that is customized with FormatterRegistrar rather than
set.
Closes gh-29636
This commit switches to 1.0.0-SNAPSHOT for Spring GraphQL, before its
upcoming 1.0.0-M6 version.
This commit adapts to the changes introduced in
spring-projects/spring-graphql#317 : now that `GraphQlClient` has been
introduced, `GraphQlTester` has been aligned with the new
infrastructure. The `@GraphQlTest` and `@SpringBootTest` testing support
is now using different variants for each.
All samples have been updated to use the proper GraphQL terminology, see
and spring-projects/spring-graphql#310 .
See gh-29637
- Adds a new @DisableOnOs annotation, which is inspired from JUnit5s
@DisableOnOs annotation. This new annotation supports the architecture
and is repeatable
Closes gh-30082
As @AutoConfiguration is now meta-annotated with @AutoConfigureAfter
and @AutoConfigureBefore, the generated property files have a lot of
superfluous lines in the format <class>.AutoConfigureAfter= and
<class>.AutoConfigureBefore=.
One can now configure in the annotation processor for each property key
if empty values should be omitted. This is currently only activated for
AutoConfigureAfter and AutoConfigureBefore
See gh-29907
The relative ordering is implemented with @AliasFor annotations on the
@AutoConfiguration annotation. The production code already works without
changes, only the test code had to be modified. It now uses
AnnotationMetadata which already knows how to deal with @AliasFor
instead of using the reflection API directly.
See gh-29907
This commit adds support for instantiating FailureAnalyzer
implementations with BeanFactory and/or an Environment constructor
arguments and deprecates support for setter injection of these values
using BeanFactoryAware and EnvironmentAware.
Closes gh-29811
The import selector will now, in addition to spring.factories, look for
ManagementContextConfiguration classes in a file called
META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports
The existing ManagementContextConfigurations have been moved from
spring.factories to the new file.
Closes gh-29730
Implements a new AutoConfigurationLoader, which loads
auto-configurations from a file in META-INF/spring-boot.
Adapts the AutoConfigurationImportSelector to use the new loader.
Adapts the ImportAutoConfigurationImportSelector to use the new loader.
Adapts the metadata plugin in the build to additionally load the
auto-configurations from the new file.
Updates the documentation for auto-configurations and test slices.
Closes gh-29872
This annotation can be used to mark auto-configurations with a dedicated
annotation. Under the hood, it's a standard @Configuration with
proxyBeanMethods set to false.
Closes gh-29870
Previously, when Tomcat was configured to use relative redirects
and the ForwardedHeaderFilter is in use, the filter would ignore
the use of the relative redirects.
This commit corrects this misalignment by applying Tomcat's use
relative redirects setting to the filter, but only when Tomcat is
being used as the servlet container.
See gh-29333
H2 2.x contains several important changes such as moving the primary key
generation mechanism to a sequence-based identifier. This commit fixes
a number of tests that were failing.
Closes gh-29651
Co-authored-by: Andy Wilkinson <wilkinsona@vmware.com>
We've seen some problems, particularly on CI, where Embedded Mongo
hangs while trying to start the Mongo process. To limit the problem,
this commit replaces the use of Embedded Mongo with Testcontainers
where we can, leaving Embedded Mongo in use only where we're
specifically testing our Embedded Mongo support.
Closes gh-28843
Prior to this commit, the GraphQL schema assembled by the
auto-configuration would provide no option for disabling the field
introspection.
While this feature is essential for many tools (including GraphiQL),
some prefer disabling it because this allows clients to gather
information about types and schema easily. This commit introduces a new
`spring.graphql.schema.introspection.enabled` configuration property.
Because potential attackers can still gather this information and this
feature is a core concern in the GraphQL spec, introspection is enabled
by default for Spring Boot applications.
Closes gh-29248
This commit configures security features for Spring GraphQL.
In the case of both MVC and WebFlux, this contributes
`DataFetcherExceptionResolver` instances to resolve security exceptions
and expose them as proper errors in the GraphQL response.
For MVC only, this also configures a
`SecurityContextThreadLocalAccessor`. This component ensures that the
security context is propagated between `ThreadLocal` and the Reactor
asynchronous execution.
See gh-29140
This commit auto-configures a GraphQL WebSocket endpoint for both Spring
MVC and Spring WebFlux. This is only enabled if the required libraries
are on the classpath and if the `"spring.graphql.websocket.path"`
property is defined.
See gh-29140
Spring GraphQL ships with a static version of the graphiql IDE for
exploring and querying GraphQL endpoints.
See https://github.com/graphql/graphiql for more information.
This commit auto-configures the GraphiQL handler for both MVC and
WebFlux and points GraphiQL to the GraphQL HTTP endpoint exposed by the
application. This feature is disabled by default and can be switched on
with "spring.graphql.graphiql.enabled=true".
See gh-29140
This commit configuresa new endpoint for printing in text format the
resolved GraphQL schema.
This endpoint is exposed by default under "/graphql/schema" and must be
enabled with "spring.graphql.schema.printer=true".
See gh-29140
This commit adds two new auto-configuration classes for Spring GraphQL
support. Once the base GraphQL infrastructure is in place, we can now
expose the `GraphQlService` over an HTTP transport.
Spring GraphQL supports both MVC and WebFlux, so this commit ships with
one auto-configuration for each.
Developers can configure the HTTP path where the GraphQL resource is
exposed using the `spring.graphql.path` configuration property (this
defaults to `"/graphql"`).
See gh-29140
This commit adds a new `FailureAnalyzer` for exceptions thrown when no
GraphQL schema file could be found.
This lists configured locations (with `"classpath:..."` notation) and
also resolved locations - this helps developers figure out how the
pattern are resolved and why schema files cannot be found.
See gh-29140
This commit adds the auto-configuration for setting up the base Spring
GraphQL infrastructure. Because GraphQL doesn't depend on any particular
transport, we must have a separate configuration for creating:
* the `GraphQlSource`, which holds the schema and the `GraphQL` instance
* the `GraphQlService` for executing incoming requests
* the `BatchLoaderRegistry` for batch loading support
* the `AnnotatedControllerConfigurer` for supporting the annotated
controllers programming model
This comes with a starting point for the `"spring.graphql.*"`
configuration properties; we can now configure the locations and file
extensions of GraphQL schema files we should load and configure at
startup.
See gh-29140
This commit maps the `server.servlet.session.cookie.same-site`
configuration property to the `DefaultCookieSerializer` bean configured
in the Spring Session auto-configuration.
See gh-28784
Update `ErrorPageSecurityFilterConfiguration` to guard against the case
where `spring-security-core` is on the classpath but
`spring-security-web` is not.
Fixes gh-28774
This commits exposes the RestClientBuilder as a bean even when the
RestHighLevelClient is not available. It allows users to create their
own RestClient beans using the Spring Boot configured RestClientBuilder
when they are not using the RestHighLevelClient.
Fixes gh-28655
Bean post-processors only apply to the context in which they're
registered. ValidationAutoConfiguration will only auto-configure the
MethodValidationPostProcessor if the post-processor is missing from
the current context and any of its ancestors. If an ancestor context
contains the post-processor it will not be auto-configured and the
descendant context will not have method validation configured.
This commit updates the auto-configuration to limit the search for
an existing MethodValidationPostProcessor bean to the current
context.
Fixes gh-27890
Update Tomcat, Jetty and Undertow `ServletWebServerFactory`
implementations so that they can write SameSite cookie attributes.
The session cookie will be customized whenever the
`server.servlet.session.cookie.same-site` property is set.
Other cookies can be customized with the new `CookieSameSiteSupplier`
interface which can be registered using `@Bean` methods.
Closes gh-20971
Co-authored-by Andy Wilkinson <wilkinsona@vmware.com>
Relocate the recently introduced `spring.webflux.session` properties
to `server.reactive.session` and create a unified `Cookie` properties
class.
Reactive session properties now mirror the existing
`server.servlet.session` properties and better reflect the fact that
they are related to the server and not just for WebFlux.
See gh-26714
Fix `WebFluxAutoConfigurationTests` following upstream Spring Framework
changes. Also refine `WebMvcAutoConfigurationTests` to check the locations
are set even if they are filtered.
See gh-28223
The `spring.integration.poller.fixed-rate` property must be set to the
constructor of the `PeriodicTrigger` and its `fixedRate` flag should be
set to `true`. The current code-base has it exactly opposite: the flag
is set to `true` when `fixed-delay` is provided.
* Fix `IntegrationAutoConfiguration.asTrigger()` method for the proper
`fixedRate` setting logic.
* Cover the change with a new test-case
* Add a message handling verification to the `defaultPoller()` test to
be sure that poller auto-configuration works as it is claimed.
See gh-28237