This commit flags the `BeanPostProcessor` registered by the reactive
embedded support as `synthetic` so that it doesn't trigger an early
initialization of other components.
See gh-8467
This commit flags the two `BeanPostProcessors` registered by the
embedded support as `synthetic` so that they don't trigger an early
initialization of other components.
Closes gh-8467
Remove the creation of a separate `HazelcastInstance` specific to caching.
Instead, the general `HazelcastAutoConfiguration` is used and if a
`HazelcastInstance` bean is present we wrap it in a `CacheManager`.
Closes gh-8470
The additional configuration for an `HazelcastInstance` will be removed
in 2.0. This commit makes sure that the property is deprecated in 1.5
See gh-8470
As of Hazelcast 3.7, the bootstrap is pretty slow by default due to the
networking discovery. This commit disables both TCP/IP and multicast
discoveries.
This commit makes sure that if `local.mongo.port` is set, a `MongoClient`
on the embedded MongoDB instance is created. When an embedded instance
is detected, only the `host` property is used and the `uri` is ignored if
set.
This makes sure that the auto-configured `MongoClient` automatically
switches to the embedded server, even if a production uri has been
specified.
Closes gh-8219
Update DataSourceInitializedPublisher to always attempt to obtain the
published DataSource directly from the EntityManager. In the case where
the EntityManager doesn't provide a DataSource, the previous logic is
used.
Fixes gh-8296
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
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
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
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
`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
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
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
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
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
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
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
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
- 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
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
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
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
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
This commit creates a separate
`ServerPropertiesServletContainerCustomizer` that holds the servlet
container customization code, separating that concern from the server
configuration keys.
See gh-8066
Previously, SocialWebAutoConfiguration would create a
SpringSocialDialect bean when SpringTemplateEngine was on the
classpath. This class exists in both Thymeleaf 2 and Thymeleaf 3 but
SpringSocialDialect is only compatible with Thymeleaf 2.
This commit updates the auto-configuration to require
SpringResourceResourceResolver to be on the classpath. This class
exists in Thymeleaf 2 but does not exist in Thymeleaf 3.
Closes gh-4858
This commit refactors the `ServerProperties` property keys and
introduces a separate "server.servlet" namespace to isolate
servlet-specific properties from the rest.
Closes gh-8066
This commit improves `@ConditionalOnWebApplication` to specify the
requested web application type. By default, any web application will
match but it can also match only if a recactive (or servlet) web
application is present.
Closes gh-8118