This commit also changes the request matcher for MVC
endpoints to use an AntPathRequestMatcher instead of an
MvcRequestMatcher. The endpoint is always available
under the mapped endpoint path and this way the same matcher
can be used for both MVC and Jersey.
Fixes gh-17912
Co-authored-by: Phillip Webb <pwebb@pivotal.io>
The userDn and password in LdapContextSource are not nullable. The
default values for userDn and password in LdapProperties are null. When
the values are set to null there will eventually be a
NullPointerException during
AbstractContextSource#setupAuthenticatedEnvironment since HashTable
doesn't allow null for values.
See gh-17861
Missing change logs would lead to an exception even
if the checkChangeLogLocation was set to false. Spring Boot's check
would pass but Liquibase would fail later making this property redundant.
Fixes gh-16232
This commit separates the auto-configuration of the `SessionFactory` in
an isolated class so that the rest of the auto-configuration is still
applied if the user provides a custom `SessionFactory` bean.
See gh-17662
This significantly rework the auto-configuration to reflect the order
in which things are expected. Rather than keeping a conceptual cycle
between the builder and the two inner classes that are processed first,
the configuration is now split in three parts:
* The builder that is required and common
* The configuration when the HighLevelClient is available
* The RestClient configuration when that's not the case
See gh-17488
* pr/17646:
Polish "Default password shouldn't be generated for resource server"
Default password should not be generated when using resource server
Closes gh-17646
This commit adds an extra condition to JdbcRepositoriesAutoConfiguration
so that it doesn't scan for repositories if a transaction manager is not
available as this dependency is now mandatory.
Closes gh-17654
Since spring-projects/spring-framework#23314 and the following commit
spring-projects/spring-framework@be4facef1b, the RSocket codec selection
is relaxed and the order of configured commits matters again.
This commit ensures that the CBOR codec is configured ahead of the JSON
codec so that it can be chosen first if no data mime type is specified
when a connection is established with a client requester.
Since spring-projects/spring-framework#23314, the `RSocketStrategies`
provide more codecs by default, and there is no need to order them to
avoid conflicts during mime type selection.
This commit also ensures that the `PayloadDecoder.ZERO_COPY` is
configured on the RSocket server if the configured `DataBufferFactory`
is compatible with that strategy.
This commit updates the `RouteMatcher` configuration after the latest
Spring Framework changes. The default route matcher implementation based
on the `PathPattern` infrastructure is now tailored for the messaging
use case (path separator, path encoding options and trailing separator).
See spring-projects/spring-framework#23310
Previously, Jackson2ObjectMapperBuilder was a singleton bean. This
meant that if it was injected and mutated in one injection point,
usage in a subsequent injection point would see the previous
injection point's mutation which can lead to unexpected failures.
This commit updates the auto-configuration of the builder to make it
a protoype bean. Mutation of the builder that is intended to apply
globally should be made using a customizer.
Closes gh-17477
Meta-annotate `ClassPathExclusions` and `ClassPathOverrides` with
so that the `ModifiedClassPathExtension` no longer needs to be
used directly.
See gh-17491
The `reactor-tools` dependency now brings a new Reactor Debug Agent
which instruments loaded classes for better Reactor stacktraces.
This commit removes the `spring.reactor.stacktrace-mode.enabled`
configuration property since the related Reactor Hook is about to be
removed.
As a replacement, we're introducing `spring.reactor.debug-agent.enabled`
which tells whether the Reactor Debug Agent should be loaded, given that
the `reactor-tools` dependency is available. This option is enabled by
default, since adding the dependency on classpath is a strong signal
already.
Fixes gh-17128
Prior to this commit, having the `spring-boot-starter-rsocket` and the
`jackson-dataformat-xml` dependencies on classpath would result in a
`ClassCastException` when the RSocket auto-configuration tries to
configure Jackson CBOR codecs for RSocket strategies.
This commit disables the Jackson XML support for the CBOR codec in
RSocket.
Fixes gh-17425
HiddenHttpMethodFilter can be problematic as it causes early
consumption of a request body if the body may contain parameters. This
happens as the filter needs to read the parameters to see if an
_method parameter is present. The filter is only beneficial for web
applications that are the hidden HTTP method functionality but is
potentially detriimental to all applications that are not. As such
we no longer believe that it should be enabled by default and users
should be required to opt in.
Closes gh-16953
Previously, if a user defined a MongoDbFactory bean but did not define
a client bean, MongoDataAutoConfiguration would back off leaving the
context without a MongoTemplate, etc.
This commit reworks the auto-configuration so that only the
auto-configuration of a MongoDbFactory is dependent on the existence
of a Mongo client bean. Auto-configuration of the other components
that depend on a MongoDbFactory will now continue in the absence of a
Mongo client bean.
Closes gh-17416
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.
Closes gh-7316
spring-kafka.2.3.0.M3 introduced a new property `RecordInterceptor` to
the container factory.
Auto-configure the property if a single instance is present.
See gh-17322
`@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