Fix `WebFluxAutoConfigurationTests` following upstream Spring Framework
changes. Also refine `WebMvcAutoConfigurationTests` to check the locations
are set even if they are filtered.
See gh-28223
The `spring.integration.poller.fixed-rate` property must be set to the
constructor of the `PeriodicTrigger` and its `fixedRate` flag should be
set to `true`. The current code-base has it exactly opposite: the flag
is set to `true` when `fixed-delay` is provided.
* Fix `IntegrationAutoConfiguration.asTrigger()` method for the proper
`fixedRate` setting logic.
* Cover the change with a new test-case
* Add a message handling verification to the `defaultPoller()` test to
be sure that poller auto-configuration works as it is claimed.
See gh-28237
Spring Framework will filter non-existent locations from any configured
static resource handlers starting with 5.3.11. Tests that verify
static resource locations should account for this change.
See gh-28223
When polling consumers or source polling channel adapters are used in
Spring Integration applications, they require some polling policy to
be configured.
This comment auto-configures a PollerMetadata bean which customized
via newly added `spring.integration.poller.*` configuration
properties or overriden completely be user-defined bean.
See gh-27992
Previously, the detector for AbstractDataSourceInitializers used the
default detector order. This resulted in the initializers detected
initializers running before Flyway. Constrastingly, the detector for
DataSourceScriptDatabaseInitializers uses a custom order so its
detected initializers would run after Flyway.
This commit aligns the order of the detector for
AbstractDataSourceInitializers with the order of the detector for
DataSourceScriptDatabaseInitializers. This ensures that script-based
initialization runs in the same order with respect to Flyway,
irrespective of which initializer implementation is driving it.
Fixes gh-28079
Previously, a number of Elasticsearch properties were duplicated
across the spring.elasticsearch.rest and
spring.data.elasticsearch.client.reactive prefixes for configuring
the blocking REST client provided by Elasticsearch and the reactive
client provided by Spring Data respectively. This could cause
problems when using the Elasticsearch REST client configured with
a custom spring.elasticsearch.rest.uris. If Spring WebFlux (to make
use of WebClient) and Spring Data Elasticsearch were on the classpath,
the reactive Elasticsearch Client would be autoconfigured but it
would use the default value of its analogous
spring.data.elasticsearch.client.reactive.endpoints property. It
would be unable to connect, causing a startup failure.
This commit consoliates the configuration properties where possible.
Each setting that is common across the two clients is now configured
using a single, shared spring.elasticsearch property. Each setting
that is specific to the blocked REST client or the WebClient-based
reactive client now have prefixes of spring.elasticsearch.restclient
and spring.elasticsearch.webclient respectively.
The old properties beneath spring.elasticsearch.rest and
spring.data.elasticsearch.client.reactive have been deprecated. If a
any deprecated property is set, all of the new properties are
ignored. In other words, to migrate to the new properties, each usage
of a now-deprecated property must be updated to use its new
replacement instead.
Closes gh-23106
`ErrorHandler/BatchErrorHandler` will be deprecated in a future release
in favor of `CommonErrorHandler`. Currently, the legacy handlers are
adapted to a `CommonErrorHandler` or ignored if a `CommonErrorHandler`
is configured.
See gh-27927
Previously, when the preferred json mapper was set to Gson, the Gson
HTTP message converter was added before any other converters. This
changed the form of String responses that were already valid. When
Jackson is in use, a string converter is used as it appears earlier
in the list than the Jackson converter. When the mapper is switched
to Gson, the Gson converter is added first in the list of converters
and the Strong converter is no longer used. This results in the
String, that was already valid JSON, being converted again. This
changes its form as quotes are escaped, etc.
This commit updates HttpMessageConverters so that the Gson converter
is added to the list immediately before the default Jackson
converter. This is done by considering the Gson converter to be an
equivalent of the Jackson converter.
Fixes gh-27354
This is a follow-on from 3fec4110 which only considered
BatchDataSourceInitializer as a possible initializer of Batch's
database schema. Flyway and Liquibase are now also considered.
Closes gh-27193
Prior to this commit, `NettyProperties` would use `DISABLED` as the
default level for leak detection in Netty. This is not the default value
enforced by Netty, which is `SIMPLE`.
This commit changes the default configuration property value and ensures
that both stay in sync.
Fixes gh-27046
The auto-config requires Spring JDBC for DataSource creation from
spring.flyway.url or spring.liquibase.url, checking Flyway migrations
exist, etc. Without it, the application fails to start due to missing
spring-jdbc classes.
This commit updates the auto-config so that it backs off in the
absence of spring-jdbc.
Closes gh-26849
Fix a bug in `DataSourceInitializationConfiguration` and in
`R2dbcInitializationConfiguration` that was stopping
custom username/password properties from being applied.
Fixes gh-26676
Update `DatabaseInitializationDependencyConfigurer` so that depends-on
ordering is applied based on the `DatabaseInitializerDetector` order.
Prior to this commit, if multiple DatabaseInitializer beans were
detected the order in which they were initialized was not defined.
See gh-26692
This commit fixes a flawed assertion that was relying on a log message
to validate the TaskExecutor is lazy. The level of the log message has
changed in framework and broke the test. We now rather check the bean
definition.
This commit fixes a flawed assertion that was relying on a log message
to validate the TaskExecutor is lazy. The level of the log message has
changed in framework and broke the test. We now rather check the bean
definition.
When we customize Couchbase's JacksonJsonSerializer with the
auto-configured ObjectMapper, Couchbase's JsonValueModule is lost.
This prevents the storage and retrieval of JSON objects.
This commit updates the Couchbase auto-configuration to use a copy
of the auto-configured ObjectMapper with the JsonValueModule added
to it.
Fixes gh-26363
Prior to this commit, the `spring.web.resources.cache.use-last-modified`
configuration property support was lost during a merge operation right
before 2.4.2.
This is due to an invalid test that missed this unintended change. This
commit fixes both problems.
Fixes gh-26212
This commit updates TaskSchedulingAutoConfiguration to contribute a
LazyInitializationExcludeFilter that processes beans that have
@Scheduled methods. This lets them be contributed to the context so
that scheduled methods are invoked as expected.
Closes gh-25315
Previously, the embedded database connection that would be used
could only be controlled via the classpath. If multiple embedded
database dependencies were present, it wasn't possible to control
the one that the auto-configured would use. It also wasn't possible
to disable auto-configuration of an embedded database.
This commit introduces a new configuration property,
spring.datasource.embedded-database-connection. It can be set to
one of the values of the EmbeddedDatabaseConnection enum to control
the auto-configuration of an embedded database. Setting it to none
will disable the auto-configuration and ensure that an external
database is used instead.
Closes gh-23412
This commit removes `org.springframework.data.annotation.Persistent`
from the annotation types used for MongoDB entity scanning to align
with Spring Data MongoDB.
Fixes gh-25797
This commit harmonizes our auto-configuration so that default converters
are configured the same way ElasticsearchConfigurationSupport does.
Closes gh-25087
Remove the restriction previously prevented `spring.mvc.servlet.path`
from being combined with a `spring.mvc.pathmatch.matching-strategy`
of `PATH_PATTERN_PARSER`. Spring Framework supports this combination
as of v5.3.4.
See gh-24805
Auto-configure `SessionAutoConfiguration` before
`WebFluxAutoConfiguration` to ensure that the correct
`WebSessionManager` bean is created.
See gh-20970
This commit adds a new `spring.webflux.session.cookie.same-site`
confuguration property that sets the default value for the "SameSite"
attribute in the WebFlux session cookies.
Closes gh-20970
Previously, using @EnableGlobalMethodSecurity would cause the
AutoProxyCreator to be created before the AOP auto-configuration had
called AopUtils.forceAutoProxyCreatorToUseClassProxying. Forcing
auto proxy creation changes the AutoProxyCreator's bean definition
so it has no effect when attempted after the creator has been created.
This commit updates the AOP auto-configuration to use a
BeanFactoryPostProcessor to force the use of class proxying. This
ensures that the changes to the auto proxy creator's bean definition
are in place before any bean creation has been performed.
Fixes gh-25413
This commit adds a new `spring.netty.leak-detection` configuration
property that selects the level of memory leak detection for the Netty
engine.
This configuration is applied statically to Netty; this means all
(non-shaded) Netty usages as client or server will be impacted by this
change.
Developers might use this property during development or tests to find
causes of memory leaks when dealing with Netty buffers.
Closes gh-14338
Restore the deprecated `JobLauncherCommandLineRunner` class and extend
removal until 2.6. The class is still needed by spring-cloud-task.
Closes gh-25807
Update the default reactive exception handler so that `MediaType.ALL`
is removed regardless of any quality setting. Prior to this commit,
the "match-all" media type was not properly ignored if it has a quality
value and would show HTML content if the accept header was
`application/json, */*;q=0.9`.
See gh-25778
Previously, the auto-configuration for DataSource initialization and
the properties used to configure it were part of the general
DataSource auto-configuration and properties.
This commit moves the auto-configuration of DataSource initialization
out into a separate top-level auto-configuration class. Similarly,
the properties for configuring DataSource initialization have been
moved from `spring.datasource.*` into `spring.sql.init.*`.
The old initialization-related `spring.datasource.*` properties have
been deprecated but can still be used. When they are used, they new,
separate initialization auto-configuration will back off. In other
words, the initialization related `spring.datasource.*` properties
and the `spring.sql.init.*` properties cannot be used in combination.
Closes gh-25323
Spring Integration comes with some global properties which can be
configured via `META-INF/spring.integration.properties`. The framework
then provides an `integrationGlobalProperties` bean as an
`org.springframework.integration.context.IntegrationProperties`
instance.
This commit allows users to configure these using regular
`application.properties`. If a `META-INF/spring.integration.properties`
file exists, the values are used as fallback.
See gh-25377
Update `FlywayAutoConfiguration`, `LiquibaseAutoConfiguration` and
`DataSourceInitializer` classes so that they no longer depend on
`DataSourceProperties`. DB migrations can now be performed against
a `@Bean` defined primary `DataSource` with an alternative
username/password.
This update also removed using fallback properties when a custom
connection `url` is defined with Flyway or Liquibase. We now assume
that `username`, `password` and `driver-class-name` will be provided
if the default values are unacceptable. Our previous logic was
particularly flawed if a custom URL caused a change of driver type.
Closes gh-25643
This commit updates EntityManagerFactoryBuilder so that persistence unit
post processors can be registered and applied when creating an
EntityManagerFactory.
See gh-25443
This commit updates EntityManagerFactoryBuilder so that persistence unit
post processors can be registered and applied when creating an
EntityManagerFactory.
See gh-25443
Previously, WebFluxAutoConfiguration's WebFluxConfigurer was unordered.
This mean that it had lowest precedence so it was not possible for a
user to provide their own configurer that was guaranteed to run after
the auto-configuration's configurer.
This commit updates the auto-configuration to order its configurer at
0. Any unordered user-defined configurer will now run after the
auto-configuration's configurer.
Closes gh-25302
This commit augments the configuration properties that are exposed for
InfluxDB, alongside an `InfluxDbCustomizer` that gives more control.
See gh-25319
This commit refactors CacheConfigurations implementation to make
it more native friendly by storing strings instead of classes in
order to avoid loading the configuration classes
when CacheConfigurations is initialized at build time.
See gh-25321
Previously, DataSource initialization was triggered via a
BeanPostProcessor or a schema created event from JPA. This caused
numerous problems with circular dependencies, bean lifecycle, etc and
added significant complexity.
This commit reworks DataSource initialization to remove the use of a
BeanPostProcessor entirely. In its place, DataSource initialization is
now driven by an InitializingBean with dependency relationships
between beans ensuring that initialization has been performed before
the DataSource is used. This aligns with the approach that's worked
well with Flyway and Liquibase.
More changes are planned to further simplify DataSource initialization.
The changes in this commit are a foundation for those changes. Any new
public API in this commit is highly likely to change before the next
GA.
Fixes gh-13042
Fixes gh-23736