Commit Graph

2511 Commits (deaa6089b0019da0f4ada042da91c857c46d1551)

Author SHA1 Message Date
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
8 years ago
Phillip Webb a4bcd20b64 Merge branch '1.5.x' 8 years ago
Phillip Webb ca1540cefe Update header copyright for changed files 8 years ago
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
8 years ago
Phillip Webb 7ed1a26c2d Fix test failures when running in Eclipse
Update MultipartAutoConfigurationTests to reset the Tomcat URL factory.
8 years ago
Phillip Webb 5867cd6175 Polish 8 years ago
Stephane Nicoll d1d70b0207 Merge branch '1.5.x' 8 years ago
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
8 years ago
Stephane Nicoll c333ccfe20 Merge branch '1.5.x' 8 years ago
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
8 years ago
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
8 years ago
Brian Clozel 3a8be10be8 Enable Tomcat, Jetty and Undertow reactive auto-conf
Closes gh-8403
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
Stephane Nicoll a38d2456c3 Merge branch '1.5.x' 8 years ago
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
8 years ago
Andy Wilkinson 4ff159adbe Merge branch '1.5.x' 8 years ago
Andy Wilkinson b034a505a5 Polish 0f42c5dd
- Apply standard code formatting
- Add class javadoc to MultipleResourceServerConfigurationTests
- Add missing @Override annotations
- Remove unused ExpectedException field
- Remove use of SpringApplicationBuilder from the tests
- Use @ImportAutoConfiguration to import auto-configuration
- Add assertions to verify that the orders haven't been changed
- Remove unnecessary mocking of EmbeddedServletContainerFactory

See gh-8347
8 years ago
Dave Syer c544aff72f Merge remote-tracking branch 'origin/1.5.x' 8 years ago
Dave Syer 0f42c5dd94 Check there is only one ResourceServerConfiguration before modifying
Fixes gh-8347
8 years ago
Madhura Bhave b8a38d60b7 Merge branch '1.5.x' 8 years ago
Madhura Bhave 67810abd9e Match ResourceServerCondition if JWK config present
Closes gh-8350
8 years ago
Stephane Nicoll 91009cfc01 Merge branch '1.5.x' 8 years ago
Stephane Nicoll 43a534f4ca Polish contribution
Closes gh-8195
8 years ago
Mathieu Ouellet fa8f0a6136 Add schema validation options for embedded LDAP
See gh-8195
8 years ago
Stephane Nicoll 4304cdb91a Merge branch '1.5.x' 8 years ago
Stephane Nicoll f57ddff478 Remove dead code
Closes gh-8305
8 years ago
Madhura Bhave b4134e239e Add autoconfiguration for JWKTokenStore
If `jwk.key-set-uri` is present.

Closes gh-4437
8 years ago
Andy Wilkinson 04a87ee4c1 Merge branch '1.5.x' 8 years ago
Andy Wilkinson 01729cc1d2 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 9e1238e286 Consider resource loader path when checking Groovy template availability
Closes gh-8304
8 years ago
Andy Wilkinson 57fe8b966e Use Spring Session's defaults for its filter's dispatcher types
Closes gh-8288
8 years ago
Andy Wilkinson fe6320db42 Align Security filter dispatcher types with Spring Security's defaults
Closes gh-8289
8 years ago
Stephane Nicoll ce6372c46f Add support of reactive repositories with `@DataMongoTest`
Closes gh-8280
8 years ago
Stephane Nicoll 50553137d3 Merge branch '1.5.x' 8 years ago
Stephane Nicoll a0ef61a27d Enable proxy target class for `MethodValidationPostProcessor`
Closes gh-8277
8 years ago
Andy Wilkinson f9015be619 Merge branch '1.5.x' 8 years ago
Andy Wilkinson e0b355d313 Avoid ClassNotFoundException caused by areturn verification
The verifier's type checker is required to check that a type returned
from a method (an areturn instruction) is assignable to the method's
declared return type. When the return type is an interface, the JLS
states that it should be treated as java.lang.Object. This means that
no analysis of the type being returned is required and verification
passes. When the return type is a class, the type being returned must
be analyzed to ensure that it is compatible. This analysis causes the
return type to be loaded during verification.

Prior to this commit, BasicBatchConfigurer's
createAppropriateTransactionManager method had a return type of
AbstractPlatformTransactionManager and a branch that could return
a JpaTransactionManager. This caused the verifier to attempt to load
JpaTransactionManager so that it could check that it was assignable
to AbstractPlatformTransactionManager. This would fail when
spring-orm is not on the classpath as JpaTransactionManager could not
be loaded.

This commit updates BasicBatchConfigurer to change the return type
of createAppropriateTransactionManager so that it returns a
PlatformTransactionManager which is an interface. As described above,
this relaxes the verification of any areturn instructions in the
method and, in this particular case stops the verifier from trying to
load JpaTransactionManager.

Closes gh-8181
8 years ago
Stephane Nicoll b30d4303d5 Polish contribution
Closes gh-8230
8 years ago
Mark Paluch 48b0f1577b Provide a starter for reactive Spring Data MongoDB
Add autoconfiguration to bootstrap MongoDB Reactive Streams driver
components, reactive Spring Data MongoDB and reactive repositories. Add
bean dependency processor for flapdoodle so embedded MongoDB instances
are configured before bootstraping the reactive MongoDB client.

Add Spring Data MongoDB Reactive starter with blocking and non-blocking
dependencies. MongoDB requires a separate driver that is used in the
`ReactiveMongoTemplate` while `MappingMongoConverter` (shared amongst
blocking/reactive Template API) requires the blocking driver to resolve
DBRefs.

See gh-8230
8 years ago
Andy Wilkinson 16b7bf7f73 Merge branch '1.5.x' 8 years ago
Andy Wilkinson 601c6aa305 Tidy up code formatting and address some compiler warnings 8 years ago
Andy Wilkinson df08863641 Make ServletRegistrationBean and FilterRegistration bean generic
Closes gh-7666
8 years ago
Stephane Nicoll 064faf9560 Merge branch '1.5.x' 8 years ago
Stephane Nicoll aa49468171 Allow to define a custom MessageRecoverer
This commit improves `SimpleRabbitListenerContainerFactoryConfigurer` to
use a custom `MessageConverter`. If such a bean is present, it is used
for the default factory that is auto-configured.

Closes gh-8194
8 years ago
Stephane Nicoll cea64f6a32 Merge branch '1.5.x' 8 years ago
Stephane Nicoll 8a59e88a9d Fix MongoDB CustomConversions bean name
This commit qualifies the `CustomConversions` bean name that the Mongo
auto-configuration might create. `CustomConversions` is a common pattern
in Spring Data and other stores are using the same name.

See https://jira.spring.io/browse/DATASOLR-362

Closes gh-8225
8 years ago