Enable MessageSourceAutoConfiguration OnMissingBeanCondition by name
rather than class since AbstractApplicationContext expects MessageSource
to be defined only with "messageSource" name.
See gh-15212
When server and management are at different ports, and when server
requires TLS client authentication, then there is no simple method to
disable TLS client authentication for management port.
This commit adds an additional "none" option to ssl.client-auth.
Example:
server.port=8080
server.ssl.enabled=true
server.ssl.client-auth=need
management.server.port=8081
management.server.ssl.enabled=true
management.server.ssl.client-auth=none
See gh-14985
Prior to this commit, `DataSourceJmxConfiguration` with tomcat
`DataSource`, it can only find `DataSourceProxy` if the given
`DataSource` is a direct child of it. Since it uses `instanceof`, it
could not find `DataSourceProxy` if the `DataSource` is
wrapped(delegated) or proxied.
This is because `DataSourceProxy#unwrap()` always returns null; thus
cannot use this method to directly obtain `DataSourceProxy`.
In this commit, updated the check logic to perform the best effort to
retrieve `DataSourceProxy`. If given `DataSource` is wrapped or proxied
by spring, tries to unwrap or get target datasource recursively to find
`DataSourceProxy`.
See gh-15206
Since gh-12838, the WebFlux whitelabel error view also shows the
stacktrace information if it is available in the model.
This commit adds a CSS directive that preserves white spaces and breaks
lines at newline characters.
`@EnableScheduling` detects primarily a suitable `TaskScheduler` in the
context and fallbacks to the presence of a `ScheduledExecutorService` if
that is not the case.
This commit improves the auto-configuration to back off when such
scheduled executor service is present, so that the framework
initialization code can pick it up as usual.
Closes gh-15032
Prior to this commit, a change in `HttpStatus.toString` since SPR-16898
prevented the default WebFlux `ErrorWebExceptionHandler` to render
template views for exact HTTP status (e.g. "404.html").
This issue does not affect the resolution of series, like "4xx.html".
This commit fixes `DefaultErrorWebExceptionHandler` to use
`HttpStatus.value()` when attempting to resolve error views.
Closes gh-15083
An initializer that adds a BeanDefinitionRegistryPostProcessor which
in turn adds bean definitions has to be very careful to run early.
Otherwise, other initializers that want to influence the bean
definitions added never get a chance.
Closes gh-14907
Fix Jetty and Undertow customizers to restore Spring Boot 2.0
behavior where a negative or zero `max-http-header-size` indicates
that the server default should be used.
Closes gh-14986
Fix `TomcatWebServerFactoryCustomizer` to restore Spring Boot 2.0
behavior where a negative or zero `max-http-header-size` indicates
that the server default should be used.
See gh-14986
Fix the `JobLauncherCommandLineRunner` to correctly deal with job
parameters when restarting a job.
Prior to this commit, we were was calling the `getNextJobParameters`
method of the `JobParametersBuilder` from batch. This method was getting
the previous parameters of the wrong job instance in a restart scenario.
This commit fixes the issue by first getting the right job instance with
the provided parameters, then restarting it.
Closes gh-14933
Add a new condition that can be used to check for servlet `Filter`
beans that are either registered directly, or via a
`FilterRegistrationBean`.
Closes gh-14940
Add a `parameterizedContainer` attribute to `ConditionalOnBean` and
`ConditionalOnMissingBean` which can be used to support generic types
when checking for the presence of beans.
Closes gh-14940
Fix `ResourceUrlEncodingFilter` conditions which were inadvertently
changed in commits 64f04fce and 6cc272ec and would back off if any
`FilterRegistrationBean` was found.
The updated conditions restores the behavior of Spring Boot 2.0.5 and
allows users to directly register their own `ResourceUrlEncodingFilter`
beans (as long as they don't use a `FilterRegistrationBean`).
Fixes gh-14897
This commit adds the following configuration properties:
* `spring.thymeleaf.render-hidden-markers-before-checkboxes`
* `spring.thymeleaf.servlet.produce-partial-output-while-processing`
Complete the restructuring of the security auto-configuration
packages by removing the direct import of web configuration from
the main security auto-configuration.
Closes gh-14412
This commit shows the stacktrace information in default WhiteLabel error
views for Spring MVC and Spring WebFlux.
This information is only shown if it is present in the model map, which
depends on the `server.error.include-stacktrace` configuration property.
Closes gh-12838
This commit auto-configures HTTP resource factories on both Reactor
Netty and Jetty server instances. This creates `ReactorResourceFactory`
and `JettyResourceFactory` beans when necessary - those beans can be
reused and applied by the client auto-configuration in order to share
resources between client and server for optimal performance.
The server auto-configuration has the highest precedence, so from now
on, the auto-configured ResourceFactory bean on the client side will be
skipped if a reactive server is configured.
Closes gh-14495
Add `Ordered` variants of `javax.servlet.Filter` and
`org.springframework.web.server.WebFilter` mainly so that we can
deprecate `FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER`.
Closes gh-14793
This commit adds a new configuration property
`"spring.webflux.hiddenmethod.filter.enable"` that enables/disables the
`HttpHiddenMethodFilter` in Spring WebFlux.
Closes gh-14520
This commit stops binding the Flyway object directly to the environment
as mutating it will no longer be supported in Flyway 6.
This commit mirrors Flyway's configuration in FlywayProperties for the
most part.
Closes gh-14776
Update the logic in `OnClassCondition` so that filtering exits on the
first missing class. Also refactor the implementation to save
unnecessary `Set` creation when there is just a single class to check.
The `AutoConfigureAnnotationProcessor` has also been updated to order
classes so that any starting `org.springframework` are considered last.
The assumption being that other classes are more likely to be missing.
Closes gh-12131
Allow custom `BinderHandler` advise to be applied to the `Binder` used
for `@ConfigurationProperties`. This mechanism has been added to allow
Spring Cloud Stream to manipulate `Bindable` instances before binding
occurs.
NOTE: This commit introduces a breaking change to the `BindHandler`
interface since the `onStart` method now returns a `Bindable` rather
than a `boolean`.
Closes gh-14745
Allow Cassandra JMX reporting to be configured via a property, and
disable it by default since it won't work with Dropwizard metrics 4.
Also update some of our own tests to explicitly disable it.
Closes gh-14778
A recent update to SpringBeanJobFactory provides the same features as
our AutowireCapableBeanJobFactory override so this commit removes it in
favour of the standard factory.
Closes gh-14772
This commit introduces a dedicated hook point for InfluxDB's http client
builder and retains backward compatibility, in a deprecated fashion, for
looking up a OkHttpClient.Builder bean.
Closes gh-14709
Previously, the JSON-B auto-configuration would be enabled when the JSON-B API was
on the classpath. This led to a failure if there was no implementation available.
The JSON-B API loads an implementation using the service loader. This commit updates
the auto-configuration to be conditional on the presence of a
META-INF/services/javax.json.bind.spi.JsonbProvider file on the classpath.
Closes gh-14675
Add a `spring.messages.reloadable` configuration property which can be
used to auto-configure a `ReloadableResourceBundleMessageSource` rather
than a `ResourceBundleMessageSource`.
Closes gh-13377
This commit fixes missing descriptions and default values when
applicable for `management.server.ssl`, `server.compression`,
`server.http2`, `server.servlet.jsp`, `server.servlet.session` and
`server.ssl`.
Those nested namespace are managed by a POJO that is declared outside
of the module of the target @ConfigurationProperties type using it. As
a result, the annotation processor has no access to the source model and
can't extract the description and the default value, if any.
This commit migrates the misleading field-level Javadoc to manual meta
data for the time being.
Closes gh-14669
Previously, when an EntityManagerFactory was being initialized
synchronously, the DataSourceSchemaCreatedEvent would be published
during its initialization. This meant that an application listener that
depends on the EntityManagerFactory would create a dependency cycle if
it was a potential recipient of the event.
For the synchronous case, this commit moves the publication of the
event so that it occurs after the initialisation of the entity manager
factory. This allows an application listener that is a potential
recipient of the DataSourceSchemaCreatedEvent to depend on the
EntityManagerFactory without creating a cycle.
Closes gh-14651
Add `Neo4jBookmarkManagementConfiguration` which provides an instance
of `BookmarkManager` if necessary and Caffeine cache is on the
classpath. Depending on the kind of application, the `BookmarkManager`
will be request scoped or singleton, as recommended by Spring Data
Neo4j.
See gh-14568
While MongoDB 3.6.7 has been released, 3.6.5 is the latest version that's supported
by the version of Embedded Mongo that we're currently using.
Closes gh-14476
Add `FilteringSpringBootCondition` base class and refactor the existing
`OnClassCondition` to use it. Also update the `match` method so that
the `autoConfigurationClasses` array may include `null` elements.
See gh-13328
Fix description for `prefetch`; remove reference to transactions since
the direct container does not support transactionSize.
Also fix `transactionSize` to just reference acks; autoConfiguration
doesn't support enabling transactions.
Closes gh-14569
Generally speaking, methods on configuration classes will only be called once
and, therefore, it should be safe to hold a reference to a Stream for later
one-time usage. However, there are some scenarios in Spring Fu where functional
registration results in an attempt being made to use a Stream more than use.
This commit protects against multiple use by storing the ObjectProvider and
getting a new ordered Stream each time it's needed.
Closes gh-14467
This commit makes sure that "org.quartz.scheduler.instanceName" is
honoured if set. Previously, "spring.quartz.scheduler-name" had a
default value and was always set. As a result, `SchedulerFactoryBean`
did not take the quartz property into account.
Closes gh-14243
While MongoDB 3.6.7 has been released, 3.6.5 is the latest version that's supported
by the version of Embedded Mongo that we're currently using.
Closes gh-14476
Spring Framework now requires that all nested configuration classes
are contained within a `@Component` class (see SPR-16839). This means
that our abstract `JpaBaseConfiguration` class should have a
`@Configuration` annotation.
Closes gh-14480
Non web applications might want to leverage
`ReactiveClientRegistrationRepository` and
`ServerOAuth2AuthorizedClientRepository` to configure `WebClient`.
Closes gh-14350
We now use com.mongodb.MongoClientSettings to configure the reactive
MongoDB driver. This is a breaking change as
MongoClientSettingsBuilderCustomizer and user-provided
MongoClientSettings beans referenced the package the settings type
from com.mongodb.async.client.
MongoClient.getSettings() is deprecated and still in use within tests
until a replacement is available.
See gh-14318
This commit also refactors OAuth2 client properties. With
the added support for authorization_code clients, client
registrations are now divided into `login` and `authorization_code`.
An environment post processor is used for backward compatibility with
old Open ID Connect login clients.
Closes gh-13812
Next to com.mongodb.MongoClient the MongoDB Java driver offers the
com.mongodb.client.MongoClient as entry point for database and
collection operations. Spring Data MongoDB supports
c.m.client.MongoClient via its MongoDbFactory using
SimpleMongoClientDbFactory.
The MongoAutoConfiguration now backs off if any of those two clients is
already defined in the Application context allowing
MongoDataAutoConfiguration to pick up the users driver implementation of
choice.
See gh-14176
This commit fixes the ordering between `CacheAutoConfiguration` and
`HibernateJpaAutoConfiguration` so that the auto-configured
`CacheManager` is configured before Hibernate starts.
Closes gh-14181
This commit introduces a subclass of `DispatcherHandler` that only
considers the current context when looking for WebFlux infrastructure
beans.
This avoids issues where a child context (e.g. with Actuator) picks up
infrastructure beans from the parent context and exposes all endpoints
instead of getting only the ones from the current context.
Closes gh-14012
This commits restores the behaviour of Spring Boot 1.x with regards to
the "trace" request param used to add the stacktrace to the model.
This was inadvertently changed so that the stacktrace would be added
if the parameter wasn't set.
Closes gh-14171
This commit adds a new auto-configuration choice for
`ClientHttpConnector`, this time using the Jetty RS HTTP client library
if available.
This is the best choice in case the application runs on a Jetty reactive
server, as both client and server will share resources.
Closes gh-14005
This commit makes sure that the auto-configuration for Spring
Integration runs after the datasource has been auto-configured if
necessary as there is an optional part that can initialize the jdbc
schema.
Closes gh-14175
This commit adds support for the new `ReactorResourceFactory` and
ensures that such a bean is created and destroyed with the application
context. This will create a `ClientHttpConnector` bean, to be configured
on the `WebClient.Builder` instance - or let developers create their own
`ClientHttpConnector` bean to override that opinion.
By default, the `ReactorResourceFactory` is configured to participate
with the global resources, for better efficiency.
Closes gh-14058
This commit adds a new `WebFluxRegistrations` interface that
allows developers to register custom instances of key WebFlux
infrastructure components, such as `RequestMappingHandlerMapping`
and `RequestMappingHandlerAdapter`.
Closes gh-13997
Because `HttpPutFormContentFilter` has been deprecated in Spring
Framework 5.1, this commit updates the auto-configuration to replace it
with the new `FormContentFilter`. This new filter is building on the
previous one and supports HTTP DELETE requests as well.
Both filters should not be used in addition, so the former
configuration has been removed. This commit also adds configuration
metadata to let developers know about the configuration key change.
Closes: gh-13363
This commit changes AbstractWebMvcEndpointHandlerMapping to
be a MatchableHandlerMapping. Additionally, EndpointRequest,
now delegates to MvcRequestMatcher for Spring MVC applications.
For all other applications, AntPathRequestMatcher is used as
a delegate.
Closes gh-13962
Previously, we would retrieve the EntityManagerFactory’s DataSource as
soon as it was being post-processed. When the native
EntityManagerFactory is being bootstrapped asynchronously, this
retrieval would block until bootstrapping had completed. This negated
some of the benefits of asynchronous bootstrapping.
This commit updates DataSourceInitializedPublisher so that it only
accesses the EntityManagerFactory’s DataSource once its bootstrapping
has completed. This is achieved using a decorated JpaVendorAdapter
that is called one the boostrapping has completed.
Closes gh-14061
In Spring Data Lovelace, repositories' bootstrap mode can be
configured via @EnableJpaRepositories. This commit adds support for
configuring the mode via the environment rather than having to use
the annotation. Additionally, when deferred or lazy bootstrapping is
being used, the LocalContainerEntityManagerFactoryBean is configured
to use a bootstrap executor. This allows JPA's initialization to be
performed on a separate thread, allowing the rest of application
context initialization to proceed in parallel.
Closes gh-13833
Since SPR-16946, Spring Framework revisited the DEBUG logging output
developers get while working on Spring MVC and Spring WebFlux
applications.
This commit aligns to those changes where DEBUG output was produced
in Spring Boot (especially in `DefaultErrorWebExceptionHandler`).
This also enables DEBUG logging on the related packages when running an
application with Spring Boot Developer Tools, providing a better
development experience.
This is also adding the new `spring.insights.web.log-request-details`
configuration property, which logs additional information about the
incoming requests at the DEBUG and TRACE levels. Since that information
can be sensitive (e.g. credentials, tokens, etc.), this property is not
enabled by default nor activated by the Developer Tools.
Closes: gh-13511
This commit adds support for providing a default ThreadPoolTaskScheduler
with sensible defaults. A new TaskSchedulerBuilder is provided with
defaults from the `spring.task.scheduler.*` namespace and can be used
to create custom instances.
If no custom `TaskScheduler` bean is present, `@EnableScheduling` now
uses the auto-configured task scheduler.
Closes gh-1397
This commit ensures that the new "spring.jmx.unique-names" property
deprecates the Endpoint's specific property as they share the same goal.
If both are set with an incompatible value, an exception is thrown
inviting the user to update their configuration.
Closes gh-13990
This commit adds support for providing a default ThreadPoolTaskExecutor
with sensible defaults. A new TaskExecutorBuilder is provided with
defaults from the `spring.task.*` namespace and can be used to create
custom instances.
If no custom `Executor` bean is present, `@EnableAsync` now uses the
auto-configure application task executor. Same goes for the async support
in Spring MVC.
Closes gh-1563