`@EmbeddedKafka` now supports JUnit 5 without the need for a Spring
test application context. Remove the previous workaround that replaced
the JUnit4 `@ClassRule` and use `TopicBuilder` to build the
topic bean.
See gh-17355
This commit removes the now outdated `HibernateEntityManagerCondition`
in favour of a simple check of `SessionImplementor`. As of
Hibernate 5.2, a single `hibernate-core` jar is required so a single
class check is enough.
Closes gh-17288
This commit removes the now outdated `HibernateEntityManagerCondition`
in favour of a simple check of `SessionImplementor`. As of
Hibernate 5.2, a single `hibernate-core` jar is required so a single
class check is enough.
Closes gh-17283
Spring Framework recently removed the `MessageHandlerAcceptor` (which is
a sub-class of `RSocketMessageHandler`).
Instead of implementing directly the `SocketAcceptor` contract, it now
exposes them through `clientAcceptor()` and `serverAcceptor()` methods.
See gh-17280
Update `NettyWebServerFactoryCustomizer` to deal with the fact that
Netty treats `0` and negative connection timeout values differently to
Tomcat, Undertow and Jetty.
See gh-16535
Both Flyway and Liquibase makes use of DataSourceProperties to get
default properties. Previously, both used strictly the configuration
properties and failed to consider embedded datasource properties
autoconfigured by @AutoConfigureTestDatabase. In case a database layer
test e.g. @JdbcTest relies on the autoconfigured embedded datasource,
Flyway and Liquibase autoconfiguration fails as they are not aware of
the embedded datasource properties.
See gh-16814
Deprecate the existing `BindResult.orElseCreate` method in favor of
`bindOrCreate` methods on the `Binder`. These new methods allow us to
implement custom creation logic depending on the type of object being
bound. Specifically, it allows constructor based binding to create new
instances that respect the `@DefaultValue` annotations.
Closes gh-17098
Co-authored-by: Phillip Webb <pwebb@pivotal.io>
Update `WebMvcAutoConfiguration` and `WebFluxAutoConfiguration` so that
`Printer<T>` and `Parser<T>` beans are automatically registered with
the conversion service.
Prior to this commit only `GenericConverter`, `Converter` and
`Formatter` beans were automatically registered.
See gh-17064
Add a new property to `RedisSessionProperties` that allows the default
`ConfigureRedisAction` to be changed. Users can still also configure
the action using a `@Bean`.
See gh-17022
Broaden the scope of customizer support so that instead of focusing
just on headers, we can now customize any outgoing `HttpClientRequest`.
Also update auto-configuration to automatically add any
`RestTemplateRequestCustomizer` beans to the builder.
See gh-17091
This commit changes the default file extension for Freemarker templates
from `*.ftl` to `*.ftlh`. This commit also enables by default the
Freemarker setting `"recognize_standard_file_extensions"` to ensure that
HTML escaping is performed by default in Spring Boot applications.
Applications should adapt to this change by changing the file extensions
of existing templates to `.ftlh`.
Closes gh-15131
This commit configures a `PathPatternRouteMatcher` in the RSocket
support if spring-web is on the classpath. This `RouteMatcher`
implementation is more efficient than the `SimpleRouteMatcher`, which is
based on the `AntPathMatcher`.
Closes gh-16865
As of Spring Data Moore, a new reactive template and the
corresponding repositories support have been added.
This commit auto-configures a `ReactiveElasticsearchTemplate`
with the configuration properties under the
`spring.data.elasticsearch.client.reactive` namespace.
To enable this feature, applications require both Spring Data
Elasticsearch dependencies (typically
`spring-boot-starter-data-elasticsearch`) and dependencies
for a `WebClient` (often `spring-boot-starter-webflux`).
The support for the reactive Elasticsearch repositories is
also provided.
Closes gh-16214
This commit auto-configures the Elasticsearch REST client support
as a template for Spring Data Elasticsearch. As of this commit,
using the transport client is still possible but developers
should migrate.
This commit also removes the deprecated annotation on the
Elasticsearch auto-configuration for the transport client, since
this deprecation notice is already present on the configuration
property.
Closes gh-17024
Closes gh-16542
Split the JUnit 5 `OutputCapture` class into separate `OutputExtension`
and `CapturedOutput` classes. The JUnit 5 callback methods are now
contained only in the `OutputExtension` class so no longer pollute the
public API that users will interact with.
The `CapturedOutput` class has also been updated to capture System.err
and System.out separately to allow distinct assertions if required.
Closes gh-17029
Update Spring Session auto-configuration to ensure that the
`DefaultCookieSerializer` doesn't break when Spring Security is not
present on the classpath.
Closes gh-16889
In the case of a WebFlux + RSocket over websocket setup, the RSocket
auto-configuration would not set up the required routes; only the
websocket endpoint for RSocket would be available, overriding the
handler configured for WebFlux.
This commit introduces `NettyRouteProvider`. Components implementing
that interface can contribute HTTP routes to the Reactor Netty server
being built.
* if none is provided, the regular handler setup is used
* if one or more routes are provided, routes are sorted and added before
the WebFlux handler (acting as a default)
Fixes gh-16826
This commit prevents the `CodecsAutoConfiguration` from being processed
if spring-webflux is not on classpath, since it is only useful for the
WebFlux server infrastructure or `WebClient`.
Closes gh-15690
This commit associates a `ConsumerAwareRebalanceListener` to the
auto-configured listener container factory if a single instance is found
in the context.
See gh-16755
Update the auto-configured Jetty `HttpClient` so that a default
`SslContextFactory` is used.
Prior to this commit connecting to https URLs would cause a
`NullPointerException`.
Fixed gh-16810
This commit auto-configures CBOR (see https://cbor.io/) codecs in the
RSocketStrategies, using Jackson binary format support.
The required dependency is added to the rsocket starter. Binary codecs
are well suited for RSocket payloads, so this codec is added first to
the list of codecs (before the JSON one already supported).
Closes gh-16830
This commit auto-configures a prototype `RSocketRequester.Builder` bean
for building requester instances. This builder is pre-configured with
auto-detected `RSocketStrategies` (same as the server side).
Closes gh-16280
Before this change it got overwritten by forwarding an empty
CacheControl to Spring. Spring itself sets CacheSeconds already
correctly in absence (=null) of a CacheControl.
Also:
* Fixes bug in WebMvcAutoConfigurationTests.cachePeriod which
prevented it to assert anything
See gh-16488
Closes gh-16730
Previously, due to a quirk in Spring Framework, it was necessary to use bean method
proxying in @Configuration classes that define one or more FactoryBeans. This quirk has
now been addressed so this commit disables bean method proxying where it is now no longer
needed.
Closes gh-16533
Since Hazlecast 3.12, YAML configuration format is supported in
addition to XML. Therefore, this change makes Spring Boot automatically
discover not only `hazelcast.xml` (and `hazelcast-client.xml`), but also
`hazelcast.yaml` (and `hazelcast-client.yaml`).
See gh-16632
Spring Session's own configuration support (i.e.
SpringHttpSessionConfiguration) will configure the default
DefaultCookieSerializer with rememberMeRequestAttribute if
SpringSessionRememberMeServices bean has been detected in the
application context.
In contrast, Spring Boot's auto-configured DefaultCookieSerializer does
not do this which results in a different out-of-the-box experience for
users that rely on Spring Session's remember-me integration.
This commit improves Spring Session DefaultCookieSerializer
auto-configuration to match Spring Session's behavior and make the
auto-configured DefaultCookieSerializer aware of
SpringSessionRememberMeServices bean.
See gh-16513
This commit adds support for configuring Undertow's server options that were previously
not configurable via application properties. The additions are the following:
- allow-encoded-slash
- always-set-keep-alive
- decode-url
- max-cookies
- max-headers
- max-parameters,
- url-charset
See gh-16278
As of Spring Data Moore, the Elasticsearch high level REST client is
supported for Spring Data repositories. The transport client is now
deprecated and is likely to be removed in a future Spring Data release.
This commit deprecates the transport client and marks all the associated
configuration properties as deprecated. The Spring Boot starter depends
on the `spring-data-elasticsearch` project, which now depends on both
transport client and high level REST client.
This commit also deprecates the Jest client, as Spring Boot will focus
on supporting the high level REST client and the reactive client
provided by Spring Data - both being in sync with the fast release pace
of Elasticsearch.
Closes gh-15008
Previously, if the `server.use-forward-headers` property
was set to true, X-Forwarded-* headers support was provided
at the server level. The property has been deprecated in favor
of `server.forward-headers-strategy` which can be also be configured
to use Spring's forwarded header support apart from native server support.
Closes gh-5677
This commit adds support for RSocket server applications.
The auto-configuration will either add RSocket support to an existing
Reactor Netty server in a WebFlux application (as a WebSocket endpoint),
or bootstrap a brand new RSocket server instance.
Spring Boot will also auto-configure the Spring Messaging infrastructure
that supports Controller beans with `@MessageMapping` annotated methods.
Fixes gh-16021
This commit migrates `AnnotationConfigReactiveWebApplicationContext`
parent to the `GenericApplicationContext` abstraction. Any use of
`AnnotationConfigWebApplicationContext` is also removed as it also
inherits from the `AbstractRefreshableApplicationContext` outdated
hierarchy.
A new `AnnotationConfigServletWebApplicationContext` context is
introduced instead, extending from `GenericApplicationContext` and
providing the counter part of the reactive context for the Servlet-based
web app tests.
See gh-16096
This commit applies changes similar to what's been done in gh-9068, for
MVC and WebFlux configurations. This is now possible thanks to the
changes done in Spring Framework in
https://github.com/spring-projects/spring-framework/pull/22596
Fixes gh-16427
This commit adds an extra check for the presence of thymeleaf-spring5
library on the classpath. ThymeleafAutoConfiguration is now only
considered if both thymeleaf-spring5 and thymeleaf jars are present.
Closes gh-16341
Since Servlet.fn support has been added in Spring Framework, new
infrastructure beans (like `HandlerAdapter` and `HandlerMapping`) have
been added.
This commit adapts the Spring MVC auto-configuration tests to reflect
those changes.
Previously, environment binding always happened in a post processor once
the bean has been created. Constructor binding requires to perform the
binding at creating time so this commit performs binding at creation
time if possible.
When this happens, a special `ConfigurationPropertiesBeanDefinition` is
created with a supplier that invokes the binder. To avoid a case where
a bean is processed twice, the post-processor now ignores any bean that
has already been bound to the environment.
Closes gh-8762
Co-authored-by: Madhura Bhave <mbhave@pivotal.io>
AssertJ includes a change in 3.12 that means that, by default, it now incorrectly
identifies some of the builder methods on CacheControl as accessor methods for its fields.
This commit restores the behaviour of 3.11 so that a method is only considered to be a
property accessor if a matches the Java bean naming conventions.
Closes gh-16145
This commit switches the default value for the `spring.jmx.enabled`
configuration property.
JMX is now disabled by default and can be enabled with
`spring.jmx.enabled=true`.
Closes gh-16090
This includes tests for the autoconfiguration using that new property.
The test require the native types for Bolt and embedded in the test
scope, so the Neo4j-OGM native types have been added to managed
dependencies.
The enhanced autoconfiguration throws an
InvalidConfigurationPropertyValueException when native types cannot be
used due to missing dependencies or wrong transport mode.
See gh-15637
Previously, the auto-configuration for both Jersey and WebMvc would auto-configure
a RequestContextFilter bean. In 2.1.0, this led to a startup failure due to the latter
attempting to override the bean defined by the former. In addition to the override there
were also problems with the order of the filter as Jersey uses -1 and MVC uses -105.
To avoid the above-described problems, the auto-configuration of the RequestContextFilter
was removed from JerseyAutoConfiguration in 2.1.1. Unfortunately, the broke
request-scoped beans for those using only Jersey.
This commit attempts to strike a better balance by reintroducing the auto-configuration
of RequestContextFilter in JerseyAutoConfiguration. It will back off if the user defines
their own filter or filter registration. WebMvcAutoConfiguration has been updated to
back off in the same manner. This leaves the potential for ordering problems, but they
are no worse than they were before. Furthermore, the user has the means to correct any
problems by using the various filter ordering properties that are provided for Jersey,
Spring Session, Spring Security, etc.
Closes gh-15376
This commit also ensures that Jersey-based actuator endpoints are
available before the user has configured a `ResourceConfig` bean
Fixes gh-15625
Fixes gh-15877
Prior to this commit, errors unhandled by custom `WebExceptionHandler`
and resulting in an HTTP 500 status would not be logged at ERROR level,
giving no information to developers about the actual exception.
This commit ensures that such exceptions are logged at the ERROR level
with their exception. By the time the exception hits the
`DefaultErrorWebExceptionHandler`, if the response is already committed
or if the exception is due to a client disconnecting, the error is
delegated to Framework support as Spring Boot won't be able to render an
error page as expected.
Fixes gh-15769
Spring Boot provides two separate auto-configurations that can
potentially expose an `AsyncTaskExecutor` implementation so relying on
the presence of a single instance is too weak.
This commit fixes the detection of the AsyncTaskExecutor that can be
used to bootstrap JPA so that a single instance is used and, in the case
more than one exists, the one named `applicationTaskExecutor`.
Closes gh-15447