Commit Graph

15402 Commits (de22f4754158df16a3c69deb74c03c1ed43cc8aa)

Author SHA1 Message Date
Brian Clozel 8e29eac887 Auto-configure GraphQL metrics
This commit auto-configures the metrics infrastructure for Spring
GraphQL.

See gh-29140
3 years ago
Brian Clozel a7839bc9b9 Add Metrics support for Spring GraphQL
This commit adds the required infrastructure for instrumenting the
GraphQL engine and datafetchers in order to collect metrics.

With this infrastructure, we can collect metrics such as:

* "graphql.request", a timer for GraphQL query
* "graphql.datafetcher", a timer for GraphQL datafetcher calls
* "graphql.request.datafetch.count", a distribution summary of
  datafetcher count per query
* "graphql.error", an error counter

See gh-29140
3 years ago
Brian Clozel a34308e5f7 Add GraphQlTest slice
This commit adds the `@GraphQlTest` annotation which brings a new type
of sliced test for GraphQL applications. This considers all the required
infrastructure brought by `@AutoConfigureGraphQl`, but also brings
application components like `@Controller` beans and
`RuntimeWiringConfigurer`.

With this type of test, we'll only initialize a minimal setup for
testing a set of Controllers, without involving any transport-related
component.

See gh-29140
3 years ago
Brian Clozel c0707e4f5b Auto-configure GraphQlTester
This commit adds the required infrastructure to auto-configure a
`GraphQlTester` or `WebGraphQlTester` in Spring Boot tests.
Specific annotations like `AutoConfigureGraphQlTester` and
`AutoConfigureWebGraphQlTester` will contribute pre-configured beans for
testing a GraphQL with the tester.

This also ships a `ContextCustomize` for contributing a `GraphQlTester`
in the case of a full `@SpringBootTest` integration test against a live
server.

See gh-29140
3 years ago
Brian Clozel 9a92a9c91d Add AutoConfigureGraphQl test annotation
This commit adds the `@AutoConfigureGraphQl` test annotation. It can be
used to import the relevant auto-configurations when testing a GraphQL
application.
Currently, it will get the main `GraphQlAutoConfiguration`, but also
what's required for configuring codecs and validation support.

See gh-29140
3 years ago
Brian Clozel 6dbcd0e95e Auto-configure security for Spring GraphQL
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
3 years ago
Brian Clozel 9954b4c63e Auto-configure Query* support for GraphQL
This commit auto-configures Spring Data Querydsl and QueryByExample
support for Spring GraphQL.

See gh-29140
3 years ago
Brian Clozel ce6747ccd6 Enable GraphiQL UI by default with Devtools
GraphiQL is useful when working on a GraphQL API - it allows
developers to craft queries and test newly developed feature. This
is not enabled by default, as this should not be exposed in production
without the developer's knowledge.

This commit flips this value when Spring Boot devtools is active for a
better developer experience.

See gh-29140
3 years ago
Brian Clozel 6ef1ed0dd0 Auto-configure GraphQL WebSocket endpoint
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
3 years ago
Brian Clozel 4ef9b9e3e5 Auto-configure CORS options for GraphQL web endpoints
This commit adds `"spring.graphql.cors.*"` configuration properties to
customize the CORS configuration for GraphQL web endpoints.

See gh-29140
3 years ago
Brian Clozel 0099460155 Auto-configure graphiql endpoint
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
3 years ago
Brian Clozel ff9a421786 Auto-configure schema printer endpoint
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
3 years ago
Brian Clozel b38d04556e Auto-configure HTTP transport for MVC and WebFlux
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
3 years ago
Brian Clozel 5cf0a4db94 Add FailureAnalyzer for InvalidSchemaLocationsException
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
3 years ago
Brian Clozel de808834f5 Auto-configure Spring GraphQL base infrastructure
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
3 years ago
Brian Clozel e5e157528b Add dependency management for Spring GraphQL
This commit adds dependency management in Spring Boot for Spring GraphQL
and GraphQL Java.

See gh-29140
3 years ago
Scott Frederick 29ad84714a Merge branch '2.6.x' into 2.7.x
Closes gh-29144
3 years ago
Scott Frederick b3a304fbe7 Merge branch '2.5.x' into 2.6.x
Closes gh-29143
3 years ago
Scott Frederick e4b0575a12 Do not consider bridge methods when binding java bean properties
Fixes gh-28917
3 years ago
Madhura Bhave ad45e76b1b Merge branch '2.6.x' into 2.7.x
Closes gh-29139
3 years ago
Madhura Bhave 84f1a6ca09 Merge branch '2.5.x' into 2.6.x
Closes gh-29138
3 years ago
Madhura Bhave 99e650bd27 Document devtools remote support not available with WebFlux
Closes gh-28955
3 years ago
Stephane Nicoll 83d732823d Merge branch '2.6.x' into 2.7.x
Closes gh-29136
3 years ago
Stephane Nicoll 653fdbd0a4 Configure comment prefixes
Closes gh-29095
3 years ago
Stephane Nicoll dea15a1103 Merge branch '2.6.x' into 2.7.x
Closes gh-29134
3 years ago
Stephane Nicoll 53654a0160 Merge branch '2.5.x' into 2.6.x
Closes gh-29133
3 years ago
Pavel Anisimov b704ee0b30 Polish reference doc
See gh-29115
3 years ago
Stephane Nicoll fd32ff3a51 Upgrade to XmlUnit2 2.8.4
Closes gh-29131
3 years ago
Stephane Nicoll fbb7f12f43 Upgrade to XmlUnit2 2.8.4
Closes gh-29123
3 years ago
Stephane Nicoll 64a5415edc Upgrade to Jackson Bom 2.13.1
Closes gh-29129
3 years ago
Stephane Nicoll d9a970a8e2 Upgrade to Infinispan 12.1.10.Final
Closes gh-29128
3 years ago
Stephane Nicoll a8fc4e9351 Upgrade to Hibernate 5.6.3.Final
Closes gh-29127
3 years ago
Stephane Nicoll 07c8ab2236 Upgrade to Ehcache3 3.9.9
Closes gh-29126
3 years ago
Stephane Nicoll 9ec44d80cf Upgrade to Dropwizard Metrics 4.2.7
Closes gh-29125
3 years ago
Stephane Nicoll 177fd6c539 Upgrade to DB2 JDBC 11.5.7.0
Closes gh-29124
3 years ago
Stephane Nicoll 620c6ec275 Upgrade to Infinispan 12.1.10.Final
Closes gh-29121
3 years ago
Stephane Nicoll d0cd7dcf60 Upgrade to Hibernate 5.4.33
Closes gh-29120
3 years ago
Stephane Nicoll cb81801907 Upgrade to Ehcache3 3.9.9
Closes gh-29119
3 years ago
Stephane Nicoll d8d97df34a Upgrade to Dropwizard Metrics 4.1.29
Closes gh-29118
3 years ago
Stephane Nicoll 8306287158 Upgrade to DB2 JDBC 11.5.7.0
Closes gh-29117
3 years ago
Stephane Nicoll bb1a1a0622 Upgrade to Spring LDAP 2.3.5
Closes gh-28972
3 years ago
Stephane Nicoll f619d66244 Upgrade to Spring LDAP 2.3.5
Closes gh-28963
3 years ago
Stephane Nicoll aab30b13b3 Start building against Spring Kafka 2.7.10 snapshots
See gh-29114
3 years ago
Stephane Nicoll 4fa0e87ba1 Merge branch '2.6.x' into 2.7.x 3 years ago
Stephane Nicoll efa93506e6 Fix checkstyle violations 3 years ago
Stephane Nicoll 84ef1f7c21 Upgrade to Log4j2 2.17.0
Closes gh-28985
3 years ago
Stephane Nicoll 012fbdd43d Upgrade to Log4j2 2.17.0
Closes gh-28984
3 years ago
Stephane Nicoll cb02944c71 Upgrade to Log4j2 2.17.0
Closes gh-28983
3 years ago
Madhura Bhave d803c53e02 Merge branch '2.6.x' into 2.7.x
Closes gh-29109
3 years ago
Madhura Bhave 4cc8012bfa Handle WebServerNamespace in CachingOperationInvoker
Fixes gh-28882
3 years ago
Madhura Bhave 764531c326 Merge branch '2.6.x' into 2.7.x
Closes gh-29108
3 years ago
Madhura Bhave d9d161cd6b Allow previously authorized users to access the error page
Prior to this commit, the `ErrorPageSecurityFilter` verified if
access to the error page was allowed by invoking the
`WebInvocationPrivilegeEvaluator` with the Authentication from the
`SecurityContextHolder`.
This meant that access to the error page was denied for a `null` Authentication
 or `AnonymousAuthenticationToken` in cases where the error page required
authenticated access. This prevented authorized users from accessing the
error page in case the Authentication wasn't retrievable for the error dispatch,
which is the case for `@Transient` authentication or stateless session policy.

This commit updates the `ErrorPageSecurityFilter` to check access to the error page
only if the error is an authn or authz error in cases where an authentication object
is not found in the SecurityContextHolder. This makes the error response consistent
when bad credentials or no credentials are used while also allowing access to previously
authorized users.

Fixes gh-28953
3 years ago
Stephane Nicoll 64dd1f86c0 Merge branch '2.6.x' into 2.7.x
Closes gh-29104
3 years ago
Stephane Nicoll c077ebecf7 Merge branch '2.5.x' into 2.6.x
Closes gh-29103
3 years ago
Andy Wilkinson 2fec06ac7e Find annotation without initializing factory beans
Closes gh-28977
3 years ago
Brian Clozel b04f7904ff Merge branch '2.6.x' into 2.7.x
Closes gh-29013
3 years ago
Brian Clozel 1c35ec2c3c Merge branch '2.5.x' into 2.6.x
Closes gh-29012
3 years ago
Brian Clozel 5d0206320a Upgrade to Logback 1.2.9
Closes gh-29011
3 years ago
Stephane Nicoll de383fcee0 Merge branch '2.6.x' into 2.7.x
Closes gh-29099
3 years ago
Stephane Nicoll bcaa59ce73 Merge branch '2.5.x' into 2.6.x
Closes gh-29098
3 years ago
Pavel Anisimov 415c58e21b Polish CacheManager customization section in reference doc
See gh-29094
3 years ago
Stephane Nicoll a05714ad9f Merge branch '2.6.x' into 2.7.x
Closes gh-29097
3 years ago
Stephane Nicoll 10362a9315 Merge branch '2.5.x' into 2.6.x
Closes gh-29096
3 years ago
Stephane Nicoll 8c9d398422 Test our Gradle plugin against Gradle 7.3.2
Closes gh-29093
3 years ago
Phillip Webb 1015df088d Merge branch '2.6.x' into 2.7.x 3 years ago
Phillip Webb 587d6fa309 Polish 3 years ago
Phillip Webb f3bcbca841 Update copyright year of changed files 3 years ago
Scott Frederick 4cad4851da Merge branch '2.6.x' into 2.7.x
Closes gh-29088
3 years ago
Scott Frederick 92b096abbf Fix message interpolation when code is used as default message
When `setUseCodeAsDefaultMessage(true)` was set on a message source,
attempting to interpolate the default message returned from the message
source would result in the code being unusable by upstream message
resolvers.

Fixes gh-28930
3 years ago
Stephane Nicoll f2efe56a18 Upgrade to Spring Framework 5.3.14 3 years ago
Stephane Nicoll a7a37f4ad6 Upgrade to Spring Framework 5.3.14
Closes gh-28970
3 years ago
Stephane Nicoll b8bf2cbbc7 Upgrade to Spring Framework 5.3.14
Closes gh-28961
3 years ago
Stephane Nicoll 63427b77d1 Merge branch '2.6.x' into 2.7.x
Closes gh-29086
3 years ago
Stephane Nicoll 55859ea64c Stop accessing the datasource if initialization mode is set to never
Closes gh-28931
3 years ago
Stephane Nicoll 4b1c0e5a03 Start building against Spring Framework 5.3.14 snapshots 3 years ago
Stephane Nicoll 38aeeee381 Merge branch '2.6.x' into 2.7.x 3 years ago
Stephane Nicoll 3b4d27e4d3 Merge branch '2.5.x' into 2.6.x 3 years ago
Stephane Nicoll 30ebb17b2b Polish 3 years ago
Stephane Nicoll a5734ef194 Upgrade to Reactor 2020.0.14
Closes gh-28969
3 years ago
Stephane Nicoll 28214e1e8c Upgrade to Reactor 2020.0.14
Closes gh-28960
3 years ago
Stephane Nicoll 4f14428351 Upgrade to Undertow 2.2.14.Final
Closes gh-29072
3 years ago
Stephane Nicoll a4fbc98667 Upgrade to Thymeleaf 3.0.14.RELEASE
Closes gh-29070
3 years ago
Stephane Nicoll 45e8711b5b Upgrade to Spring WS 3.1.2
Closes gh-29069
3 years ago
Stephane Nicoll 3bbc4649b7 Upgrade to MSSQL JDBC 9.4.1.jre8
Closes gh-29068
3 years ago
Stephane Nicoll 36332d42b8 Upgrade to JUnit Jupiter 5.8.2
Closes gh-29066
3 years ago
Stephane Nicoll 657f6e0010 Upgrade to Jedis 3.7.1
Closes gh-29065
3 years ago
Stephane Nicoll afd254424b Upgrade to JDOM2 2.0.6.1
Closes gh-29064
3 years ago
Stephane Nicoll 7156e3fb23 Upgrade to HttpCore 4.4.15
Closes gh-29063
3 years ago
Stephane Nicoll 0219408b7e Upgrade to HttpAsyncClient 4.1.5
Closes gh-29062
3 years ago
Stephane Nicoll 081d4f6d9c Upgrade to Hibernate 5.6.2.Final
Closes gh-29061
3 years ago
Stephane Nicoll 76b1ec3cac Upgrade to Hazelcast 4.2.3
Closes gh-29060
3 years ago
Stephane Nicoll 84d552f4d2 Upgrade to Flyway 8.0.5
Closes gh-29059
3 years ago
Stephane Nicoll fedf341d65 Upgrade to Ehcache3 3.9.8
Closes gh-29058
3 years ago
Stephane Nicoll 0165c40f02 Upgrade to Dropwizard Metrics 4.2.5
Closes gh-29057
3 years ago
Stephane Nicoll b11aa6d5cd Upgrade to Couchbase Client 3.2.4
Closes gh-29056
3 years ago
Stephane Nicoll d80e68adf0 Upgrade to Caffeine 2.9.3
Closes gh-29055
3 years ago
Stephane Nicoll c45bdd19fd Upgrade to AppEngine SDK 1.9.93
Closes gh-29054
3 years ago
Stephane Nicoll 97ee63b55b Upgrade to Undertow 2.2.14.Final
Closes gh-29051
3 years ago
Stephane Nicoll 74ce8b7516 Upgrade to Thymeleaf 3.0.14.RELEASE
Closes gh-29049
3 years ago
Stephane Nicoll e234ccd457 Upgrade to Spring WS 3.1.2
Closes gh-29048
3 years ago