Rather than using two properties to enable or disable reactive and
imperative repositories for a particular store, this commit introduces
a new repository type condition that's backed by a single
spring.data.<store>.repositories.type property. The type can be
auto (automatically enables whatever's available), imperative (enables
imperative repositories), none (enables nothing), or reactive (enables
reactive repositories). The default is auto.
Repositories do not have a reactive option (such as JPA) continue to
have a spring.data.<store>.repositories.enabled property that takes a
boolean value.
Closes gh-11134
If the WebFlux handler commits the response but still sends an error
signal in the reactive pipeline, Spring Boot error handling should not
try to handle that error: once committed, it is impossible to change the
response status or the response headers. Writing to the body might also
lead to invalid responses.
This commit skips error handling if the response is committed and
delegates to Spring Framework's `HttpWebHandlerAdapter` which will log
the error.
Fixes gh-11168
This commit adds support for basic auto-configuration for the Freemarker
template engine in WebFlux.
A few configuration properties in the `spring.freemarker.*` namespace
aren't supported yet, since they mostly apply to MVC (Servlet request
and session attributes).
Closes gh-10094
Elasticsearch server requires log4j-core but we don't want the entire
module to have a test dependency on log4j-core as it already uses
Logback. This commit uses the modified class path runner to make
log4j-core available specifically to the Elasticsearch-related tests.
See gh-11166
Rename `reactive-repositories` to `reactiverepositories` and replace
`spring.resources.cache-control` with `spring.resources.cache.control`.
Fixes gh-11090
Previously, custom Hibernate naming strategies could only be
configured via properties. This allowed a fully-qualified classname to
be specified, but did not allow a naming strategy instance to be used.
This commit updates HibernateJpaConfiguration to use
ImplicitNamingStrategy and PhysicalNamingStrategy beans if they
exist. If both a bean exists and the equivalent property has been set,
the bean wins.
This commit adds several configuration keys for customizing the
"Cache-Control" HTTP response header when serving static resources.
New keys are located in the "spring.resources.cache-control.*"
namespace; anything configured there will prevail on existing
"spring.resources.cache-period=" values, so as to mirror Spring MVC's
behavior.
Fixes gh-9432
Update appropriate configuration properties to use the `Duration`
type, rather than an ad-hoc mix of milliseconds or seconds.
Configuration properties can now be defined in a consistent and readable
way. For example `server.session.timeout=5m`.
Properties that were previously declared using seconds are annotated
with `@DurationUnit` to ensure a smooth upgrade experience. For example
`server.session.timeout=20` continues to mean 20 seconds.
Fixes gh-11080
Add `spring.kafka.producer.transaction-id-prefix` property that will be
passed to `DefaultKafkaProducerFactory.setTransactionIdPrefix(...)`
See gh-11076
This commit updates `SessionAutoConfiguration` to ensure it is processed
after `MongoDataAutoConfiguration` and
`MongoReactiveDataAutoConfiguration`, instead of `MongoAutoConfiguration`
and `MongoReactiveAutoConfiguration`. This is required in order for
MongoDB Session auto-configuration to work, since
`MongoSessionConfiguration` and `MongoReactiveSessionConfiguration` are
conditional on `MongoOperations` and `ReactiveMongoOperations` beans,
respectively.
Closes gh-11054
Update `RedisProperties` to use an actual String[] for sentinal nodes
rather than a simple String. This allows us to lean on the updated
binder to automatically trim the elements.
Fixes gh-11029
Expose key prefix, TTL and null value settings for spring-data-redis'
RedisCacheConfiguration in Spring .properties/yml configuration files.
Example:
spring.cache.redis.ttl=PT15M
spring.cache.redis.keyPrefix=foo
spring.cache.redis.useKeyPrefix=false
spring.cache.redis.cacheNullValues=false
See gh-10795
Refactor `ReactiveWebApplicationContext` implementations to align closer
with the `WebApplicationContext` implementations defined in
Spring Framework.
The following classes are now provided:
- `AnnotationConfigReactiveWebApplicationContext` -- A refreshable
reactive web context with support for `@Configuration` classes.
- `GenericReactiveWebApplicationContext` -- A non-refreshable reactive
GenericApplicationContext.
- `ReactiveWebServerApplicationContext` -- A non-refreshable reactive
GenericApplicationContext with support for server discovery.
- `AnnotationConfigReactiveWebServerApplicationContext` -- A
non-refreshable reactive `GenericApplicationContext` with support
for `@Configuration` classes and server discovery.
These classes roughly align to the following Servlet equivalents:
- `AnnotationConfigWebApplicationContext` (Spring Framework)
- `GenericWebApplicationContext` (Spring Framework)
- `ServletWebServerApplicationContext` (Spring Boot)
- `AnnotationConfigServletWebServerApplicationContext` (Spring Boot)
An additional `ConfigurableReactiveWebEnvironment` interface as also
been introduced, primarily for `@ConditionalOnWebApplication` to use.
Fixes gh-10852
This commit ensures that all errors handled by the
`DefaultErrorWebExceptionHandler` (Spring WebFlux error convetion
support) logs an error with request information and exception
stacktrace.
This is limited to errors that result in an HTTP 5xx error.
Exceptions that extend `ResponseStatusException` and set a non-5xx
status will not be logged.
Closes gh-10904
This commit adds a new configuration properties class for configuring
HTTP/2 protocol support.
By default, this protocol is disabled as enabling it requires several
manual changes:
* configuring a web server for proper TLS and ALPN support
* configuring a proper SSL certificate
See gh-10043
Flyway implicitly adds classpath: to locations without a prefix but
resource loader fails to find migratons on the classpath without the
prefix.
Add an explicit classpath: prefix so that both Flyway and the resource
loader used to check the locations can find the migration location.
See gh-10807
Move logic from `ParameterNameMapper` into `ReflectiveOperationInvoker`
in order to reduce the surface area of the public API.
Also rename some classes for consistency.
Instead of looking for the presence of `WebSecurityConfiguration`,
this commit checks for the presence of a `Filter` with the name
springSecurityFilterChain. This allows users to configure the Filter
without adding `WebSecurityConfiguration`, making it more flexible.
`springSecurityFilterChain` is somewhat of a contract in Spring Security
and it relies on the name being `springSecurityFilterChain`.
Closes gh-10849
This commit updates `WebFluxSecurityConfiguration` to look for a
`WebFilterChainProxy` rather than the default configuration that
`@EnableWebFluxSecurity` triggers. The latter is now package private.
This commit renames spring.datasource.initialize to
spring.datasource.initialization-mode and use the
DataSourceInitializationMode enum. By default, only an embedded
datasource is initialized.
Closes gh-10773
This commit makes sure that the `replyTemplate` is set if a
KafkaTemplate is available in the context which effectively add support
for `@SendTo`.
Closes gh-10669
Following some changes in the latest snapshot this includes:
- Some updates to oauth2 client auto-config
- Security auto-config no longer relies on GlobalAuthenticationConfigurerAdapter
- Remove reactive security starter
Closes gh-10704
Starting with Hibernate 5.2.10, the JPA property
`hibernate.connection.provider_disables_autocommit` should be set to true
when the datasource has autocommit disabled in order to improve
performance.
See gh-9737
This commit adds support for Spring Boot error conventions with WebFlux.
The Spring MVC support for that is based on an `Controller` that's
mapped on a specific `"/error"` path and configured as an error page in
the Servlet container. With WebFlux, this support leverages a
`WebExceptionHandler`, which catches exceptions flowing through the
reactive pipeline and handles them.
The `DefaultErrorWebExceptionHandler` supports the following:
* return a JSON error response to machine clients
* return error HTML views (templates, static or default HTML view)
One can customize the error information by contributing an
`ErrorAttributes` bean to the application context.
Spring Boot provides an `ErrorWebExceptionHandler` marker interface and a
base implementation that provides high level constructs to handle
errors, based on the Spring WebFlux functional flavor.
The error handling logic can be completely changed by providing a custom
`RouterFunction` there.
Fixes gh-8625
Move projects to better reflect the way that Spring Boot is released.
The following projects are under `spring-boot-project`:
- `spring-boot`
- `spring-boot-autoconfigure`
- `spring-boot-tools`
- `spring-boot-starters`
- `spring-boot-actuator`
- `spring-boot-actuator-autoconfigure`
- `spring-boot-test`
- `spring-boot-test-autoconfigure`
- `spring-boot-devtools`
- `spring-boot-cli`
- `spring-boot-docs`
See gh-9316