Commit Graph

50613 Commits

Author SHA1 Message Date
Stephane Nicoll
36cb8b9e0c Start building against Spring Data Ingalls snapshots
See gh-8444
2017-03-01 09:37:52 +01:00
Stephane Nicoll
ebd3a65c9d Merge branch '1.4.x' into 1.5.x 2017-03-01 09:36:37 +01:00
Stephane Nicoll
66e6671dcb Start building against Spring Data Hopper snapshots
See gh-8443
2017-03-01 09:35:38 +01:00
Andy Wilkinson
e20219aac9 Merge branch '1.5.x' 2017-02-28 15:58:22 +00:00
Andy Wilkinson
545b29552d Merge branch '1.4.x' into 1.5.x 2017-02-28 15:58:08 +00:00
Andy Wilkinson
51e7c2eec9 Merge pull request #8252 from Erling Holmqvist
* gh-8252:
  Polish "Ignore spock.lang annotations when creating test context cache key"
  Ignore spock.lang annotations when creating test context cache key
2017-02-28 15:57:54 +00:00
Andy Wilkinson
98cf35d48e Polish "Ignore spock.lang annotations when creating test context cache key"
See gh-8252
2017-02-28 15:55:55 +00:00
erlholmq
8f18df8a9c Ignore spock.lang annotations when creating test context cache key
See gh-7524
Closes gh-8252
2017-02-28 15:49:35 +00:00
Stephane Nicoll
20bd0f94d6 Merge branch '1.5.x' 2017-02-28 15:58:23 +01:00
Stephane Nicoll
f014be59f7 Merge pull request #8392 from kazuki43zoo:polish-doc
* pr/8392:
  Update doc about constructor injection
2017-02-28 15:58:08 +01:00
Kazuki Shimizu
fa4ecff9e0 Update doc about constructor injection
Closes gh-8392
2017-02-28 15:57:57 +01:00
Stephane Nicoll
cf64d9fd35 Reuse auto-configured Validator in WebFlux
This commit makes sure that if a `Validator` is auto-configured, it is
reused as the `webFluxValidator`. This is pretty much the same thing as
what was done recently for Spring MVC.

Since the infrastructure is now shared, the package protected class has
been published in the `.validation` package.

Closes gh-8400
2017-02-28 15:49:21 +01:00
Stephane Nicoll
deaa6089b0 Move HttpHandler configuration to a dedicated auto-configuration
An `HttpHandler` bean must be provided once the infrastructure triggered
by `@EnableWebFlux` has been processed. Rather than creating a
`HttpHandler` in that auto-configuration, this commit moves it to a
dedicated auto-config, like we do for `DispatcherServlet` for
servlet-based webapps.

As this is the only bean we auto-configure in a functional fashion, the
`WebFluxFunctionalAutoConfiguration` is now merged with this new
auto-configuration, making its purposes clearer.

Cloess gh-8436
2017-02-28 15:18:23 +01:00
Andy Wilkinson
23cda9012c Merge branch '1.5.x' 2017-02-28 12:26:04 +00:00
Andy Wilkinson
627edc0f7a Use a different approach to disable HATEOAS Objenesis instance's cache
Previously, reflection was used to set the OBJENESIS field of
DummyInvocationUtils with an Objenesis instance that does not use
caching. This has stopped working as the field is now declared final.

This commit updates the approach take by HateoasObjenesisCacheDisabler
to disable Objenesis's cache. Rather than changing the value of the
OBJENESIS field on DummyInvocationUtils, the cache field on the
ObjenesisStd instance is set to null instead. This has the desired
effect of disabling Objenesis's caching.

See gh-3784
Closes gh-8335
2017-02-28 12:24:19 +00:00
Andy Wilkinson
1c24d89be7 Merge branch '1.5.x' 2017-02-28 10:42:04 +00:00
Andy Wilkinson
d1184bf180 Merge branch '1.4.x' into 1.5.x 2017-02-28 10:41:51 +00:00
Andy Wilkinson
47a59a92d1 Start building against Spring Integration 4.3.8 snapshots
See gh-8435
2017-02-28 10:40:30 +00:00
Phillip Webb
a4bcd20b64 Merge branch '1.5.x' 2017-02-27 20:43:18 -08:00
Phillip Webb
ca1540cefe Update header copyright for changed files 2017-02-27 20:41:18 -08:00
Phillip Webb
77f6ed8357 Further rework Spring MVC JSR-303 validation
Rework Spring MVC JSR-303 validation support a little more to move
most of the creation logic to the wrapper class. Also rename
`SpringValidatorAdapterWrapper` -> `WebMvcValidator`.

See gh-8223
2017-02-27 20:41:18 -08:00
Phillip Webb
7ed1a26c2d Fix test failures when running in Eclipse
Update MultipartAutoConfigurationTests to reset the Tomcat URL factory.
2017-02-27 20:41:18 -08:00
Phillip Webb
5867cd6175 Polish 2017-02-27 20:41:18 -08:00
Phillip Webb
47fd5f4fac Merge branch '1.4.x' into 1.5.x 2017-02-27 14:00:46 -08:00
Phillip Webb
47b00c086c Polish 2017-02-27 13:56:17 -08:00
Phillip Webb
f6db1cbcb2 Extend Microsoft SQL Server detection
Update Microsoft SQL Server detection logic to retain "SQL SERVER"
support (just in case the server string is driver specific).

See gh-8222
2017-02-27 13:41:34 -08:00
Stephane Nicoll
d1d70b0207 Merge branch '1.5.x' 2017-02-27 19:10:03 +01:00
Stephane Nicoll
0435f122d4 Rework JSR-303 validation exposure with Spring MVC
This commit improves the initial solution by actually overriding the
`mvcValidator` `@Bean`. This gives us more control as whether a custom
validator has been specified or not. We now wrap it regardless of it
being custom or provided by auto-configuration.

Closes gh-8223
2017-02-27 19:09:29 +01:00
Stephane Nicoll
c333ccfe20 Merge branch '1.5.x' 2017-02-27 16:16:21 +01:00
Stephane Nicoll
d8f62c46ad Prevent warning due to BPP dependency
`MethodValidationPostProcessor` requires a `Validator` so we need to flag
it as an infrastructure bean to prevent an additional log that indicates
it won't be post-processed.

We obviously don't want to post-process the `Validator` here so adding the
additional meta-data is a good idea anyway.

Closes gh-8422
2017-02-27 16:16:09 +01:00
Stephane Nicoll
c5595f296c Add support for Mock test with WebFlux
This commit add mock support for WebFlux with an infrastructure similar
to what `WebMvcTest` provides. `@WebFluxTest` can be used to test
controllers with a narrowed classpath that is relevant to WebFlux. Also,
`@SpringBootTest` now starts WebFlux in "mock" mode by default and
`@AutoConfigureWebTestClient` can be used to inject a `WebTestClient`
connected to the `ApplicationContext`.

To make that happen, a `ReactiveWebApplicationContext` interface has been
introduced to mirror what `WebApplicationContext` currently does. Things
are still a bit volatile at this point and that infra may move to Spring
Framework at some point.

Closes gh-8401
2017-02-27 15:05:34 +01:00
Stephane Nicoll
30564eb619 Merge branch '1.5.x' 2017-02-26 23:19:14 +01:00
Stephane Nicoll
f032d2fe03 Polish
Closes gh-8412
2017-02-26 23:18:48 +01:00
Brian Clozel
3a8be10be8 Enable Tomcat, Jetty and Undertow reactive auto-conf
Closes gh-8403
2017-02-24 17:46:04 +01:00
Stephane Nicoll
f1d4d8434b Hide javax.servlet.SessionTrackingMode
The server's session can now be configured in both a servlet and a
reactive environment. The latter has not requirement on the servlet API
and this commit removes the requirement to the `SessionTrackingMode`
enum.

Closes gh-8402
2017-02-24 17:41:39 +01:00
Brian Clozel
f12a634843 Fix typo in spring-webflux dependency 2017-02-24 14:03:16 +01:00
Brian Clozel
d1eafa29da Add missing dependency in docs generation
Reactor Netty and Spring WebFlux were missing.
2017-02-24 13:57:09 +01:00
Stephane Nicoll
12397edbd4 Expose a WebTestClient with @SpringBootTest
This commit exposes a `WebTestClient` automatically in a reactive
integration test that uses an embedded web server. This is similar to
what we do with `TestRestTemplate` for servlet based integration tests.

Closes gh-8399
2017-02-24 13:50:58 +01:00
Brian Clozel
c1e93d8991 Add WebFlux application sample
This commit adds a sample application for the
annotation variant of Spring WebFlux.
2017-02-24 13:03:12 +01:00
Stephane Nicoll
54939e8e3c Start a reactive web application if necessary
This commit makes sure that `@SpringBootTest` with a reactive setup
starts a web application if necessary.

If both a servlet and a reactive environment are available, a servlet
environment is bootstraped. This commit also adds a way to force a
reactive environment by specifying the `spring.main.web-application-type`
property of the test (e.g. `@TestPropertySource`).

Closes gh-8383
2017-02-24 13:03:12 +01:00
Brian Clozel
8317977e1b Add WebFlux auto-configuration
This commit creates auto-configuration classes for both the
annotation and functional variants of the WebFlux framework.

They provide the basic support to get started with those, by
creating the required `HttpHandler` using the provided application
context (for annotation) or `RouterFunction`s (for functional).

They do support `WebFilter` registration and a few advanced
features such as resource handling, `messageReaders|Writers`
and `ViewResolver` auto-registration.

Closes gh-8386
2017-02-24 13:03:11 +01:00
Brian Clozel
656b509f03 Add support for reactive web servers auto-configuration
This commit adds the auto-configuration for creating reactive
`EmbeddedWebServer` instances. This adds support for the
following servers: Reactor Netty, Tomcat, Jetty and Undertow.

Fixes gh-8302
Fixes gh-8117
2017-02-24 13:03:11 +01:00
Brian Clozel
dc98d909ab Support reactive web servers with LocalServerPort
This commit refactors the `EmbeddedWebServerInitializedEvent` hierarchy
to have one specialized event for Servlet based apps and another one for
reactive apps.

Each event implementation has:

* a specific `ApplicationContext` implementation for the app
* a custom `getServerId` implementation that differentiates the
application server from the management server

Closes gh-8348
2017-02-24 13:03:11 +01:00
Brian Clozel
0b162e894b Manage EmbeddedWebServer in ReactiveWebApplicationContext
This commit adds an `EmbeddedWebServer` instance to the
`ReactiveWebApplicationContext` and ties it to the application
lifecycle.

To launch a reactive web application, two elements are required
from the context:

* a `ReactiveWebServerFactory` to create a server instance
* a `HttpHandler` instance to handle HTTP requests

Closes gh-8337
2017-02-24 13:03:11 +01:00
Brian Clozel
21878f8528 Manage Netty in Boot dependencies 2017-02-24 13:03:11 +01:00
Brian Clozel
f331ac133f Add reactive web server infrastructure
This commit adds the infrastructure for creating and customizing
reactive embedded web servers. Common configuration has been refactored
into the new `ConfigurableEmbeddedWebServer` interface.

See gh-8302
2017-02-24 13:03:11 +01:00
Stephane Nicoll
a38d2456c3 Merge branch '1.5.x' 2017-02-24 11:05:27 +01:00
Stephane Nicoll
4aa99b9531 Avoid exposing several javax.validaton.Validator beans
This commit makes sure that the Spring `Validator` used by the MVC
layer doesn't expose a JSR-303 contract, if any.

The default implementation of the `mvcValidator` is
`LocalValidatorFactoryBean`. While this object is exposed as a Spring
`Validator` only, its runtime capabilities expose that contract as well
as the standard `Validator` and `ValidatorFactory` ones.

Concretely, if an auto-configuration is checking if a
`javax.validation.Validator` bean is missing, the condition will match
since we only know about "advertized types": beans haven't been created
yet so we can't inspect their runtime capabilities. Since the condition
match, we will auto-configure a bean. At runtime though, we're no longer
ale to inject a `javax.validation.Validator` by type since two candidates
are available.

This commit introduces `SpringValidatorAdapterWrapper`, a wrapper class
on any `SpringValidatorAdapter` (`LocalValidatorFactoryBean` being one of
the available implementations) that only exposes the Spring contract.

Also, if a `javax.validation.Validator` bean is available, we will use it
for the MVC layer, rather than creating a new one.

Closes gh-8223
2017-02-24 11:01:42 +01:00
Andy Wilkinson
3164330139 Correct HAL Browser location to reflect version of web jar
See gh-8382
2017-02-22 16:53:29 +00:00
Andy Wilkinson
7e6ad316aa Update exclusions to reflect change in Hibernate's JPA API dependency
See gh-8379
2017-02-22 16:33:50 +00:00