This commit updates `MapSessionRepository` bean definition return type
and applies equivalent change to `SessionAutoConfigurationTests`.
These changes also ensure compatibility with Spring Session 2.0 which
will merge `ExpiringSession` API with `Session` API.
Closes gh-9145
Move `spring.rabbitmq.listener.*` to `spring.rabbitmq.listener.simple.*`
in preparation for Spring AMQP 2.0 that supports different container
types.
Closes gh-9108
See gh-9055
This commit provides an auto-configuration for reactive Redis and a
starter that provides Lettuce as Jedis doesn't support reactive
operations.
There are no support for reactive redis repositories at the moment so
only a `ReactiveRedisTemplate` is auto-configured if necessary.
Closes gh-8053
Introduce an alternative autoconfiguration if the lettuce Redis driver is
available. Add Lettuce-specific configuration property options
"spring.redis.lettuce.shutdown-timeout" to control the shutdown timeout
of the lettuce driver. Add documentation for the properties, the
supported drivers, and how to switch between drivers.
Split client-specific properties from spring.redis.pool to
spring.redis.jedis.pool and introduce spring.redis.lettuce namespace.
Deprecate spring.redis.pool property.
See gh-5311
Update `DefaultServletWebServerFactoryCustomizerTests` so that the Jetty
access log tests use the default timezone. Prior to this commit it was
possible that running the tests outside of UTC could result in Jetty
throwing a "negative delay" IllegalArgumentException.
See gh-8819
This commit changes the default file extension for Mustache templates,
from `.html` to `.mustache`, which is the file extension used in the
official reference documentation and by most IDE plugins.
Fixes gh-8997
Thymeleaf 3.0 implements the Spring 5.0 view infrastructure for WebMVC
and the new WebFlux framework. This commit adds auto-configuration for
the WebFlux support.
In that process, the configuration property for `spring.thymeleaf` has
been changed to add `spring.thymeleaf.servlet` and
`spring.thymeleaf.reactive` for MVC/WebFlux specific properties.
Now that the `spring-boot-starter-thymeleaf` does not only support
Spring MVC, the transitive dependency on `spring-boot-starter-web` is
removed from it.
Fixes gh-8124
This commit ensures that a primary JSR 303 and Spring Validator will be
exposed if the auto-configuration kicks in. As `LocalValidatorFactoryBean`
exposes 3 contracts (JSR-303 `Validator` and `ValidatorFactory` as well as
the `Spring` validator one), this makes sure that those types can be
injected by type.
`LocalValidatorFactoryBean` exposes 3 contracts and we're only checking
for the absence of a `javax.validation.Validator` to auto-configure a
`LocalValidatorFactoryBean`. If no standard JSR validator exists but a
Spring's `Validator` exists and is primary, we shouldn't flag the
auto-configured one as `@Primary`. Previous iterations on this feature
have made sure that we'll auto-configure at most one
`javax.validation.Validator` so not flagging it `@Primary` is no problem.
This commit also restores and adds tests that validates
`ValidationAutoConfiguration` will configure a JSR validator even if a
Spring Validator is present.
This effectively fixes gh-8495 in a different way.
Closes gh-8979
Closes gh-8976
Remove the `relaxed` attribute from `@ConditionalOnProperty` and instead
rely on the direct configuration property source relaxed name support.
Closes gh-9003
`BasicErrorControllerIntegrationTest` is handling the context in each test
and yet it starts a useless test via `@SpringBootTest`. This commit
removes the useless runner and associated annotations.
Refine Mustache support to provide a cleaner separation between the
reactive and servlet implementations. The views have now moved to the
`spring-boot` project and the auto-configuration has been split into
two distinct `@Imports` to save needing full package declarations.
See gh-8941
This commit simplifies the Mustache support for Spring MVC and removes
the included (view-based) i18n support in favor of more idiomatic
constructs like Mustache lambdas.
Fixes gh-8941
This commit moves the existing Spring MVC Mustache support to its own
`servlet` package and adds a new one under `reactive` for the WebFlux
web applications.
New `MustacheView` and `MustacheViewResolver` types resolve and render
Mustache views for WebFlux applications.
Since this templating engine is now supported by two flavors of Spring
web apps, the `spring-boot-starter-mustache` does not depend anymore on
the `spring-boot-starter-web` one: it's up to the developer to add the
relevant starter `web` or `webflux` to their application.
Fixes gh-8648
Replace the MVC validator post processor with an `@Import` so
that a "cannot enhance @Configuration bean definition"
warning does not occur.
Fixes gh-8951
See gh-8495
Update `PropertiesLauncher` so that classes can be loaded outside of
`BOOT-INF/classes`. You can use a subdirectory, or the root directory
of an external jar (but not the parent archive to avoid issues
with agents and awkward delegation models).
Fixes gh-8480
Closes gh-8486
Relax `SpringBootTestContextBootstrapper` rules so that a test can
specify an `ApplicationContextInitializer` and still have
`@SpringBootConfiguration` detected.
Prior to this commit detection would not occur because it's possible
that an initializer _could_ register configuration. This scenario is
actually quite unlikely to occur, certainly less likely than wanting to
use an initializer in combination with auto-detection.
Fixes gh-8483
Update `ValidationAutoConfiguration` and `WebMvcAutoConfiguration` to
ensure as much as possible that only a single Validator bean of each
type is registered.
Validation auto-configuration now does the following:
- If no validator is found: Registers a `LocalValidatorFactoryBean`
(providing both Spring and JSR validation)
- If the user defines a Spring & JSR validator: Backs off
- If the user defines only a JSR validator: Adapts it to a Spring
validator (without exposing another JSR implementation)
WebMvcAutoConfiguration auto-configuration has been updated to make
MVC validation follow common Spring Boot patterns:
- If not validator beans are found (due to the user excluding
ValidationAutoConfiguration) a new `mvcValidator` bean will be
registered.
- If a single validator bean is found it will be used for MVC
validation.
- If multiple validator beans are defined it will either use the one
named `mvcValidator` or it will register a new `mvcValidator` bean
Any automatically registered `mvcValidator` bean will not implement
the JSR validator interface.
Finally, it is no longer possible to provide an MVC validator via a
`WebMvcConfigurer`.
Fixes gh-8495
Allow `PathExtensionContentNegotiationStrategy` to be bypassed by
actuator endpoints. Prior to this commit calling `/loggers/com.aaa.cab`
would return a HTTP 406 response due to `.cab` being a known extension.
Fixes gh-8765
Update `ResourceServerTokenServicesConfiguration` to fail fast if the
`getKeyFromServer()` call fails. Since the key is part of the singleton
`JwtAccessTokenConverter` bean there is not real way to refresh without
restarting the application.
A hard failure seems preferable to an inconsistent state.
Closes gh-8924
Since SPR-15415 and SPR-15435, the HandlerStrategies and its companion
builder are now using the new CodecConfigurer infrastructure to
configure codecs in a cross-cutting way.
This commit looks for a custom instance of `HandlerStrategies.Builder`
provided by the user, or create a default one if none was found.
Fixes gh-8897
This commit makes sure to honour the `spring.aop.proxy-target-class`
property if set by the user. Previously, the
`PersistenceExceptionTranslationPostProcessor` was always configured to
use cglib, regardless of the value of that property.
Closes gh-8887
This commit separates the JPA-specific bits of the batch
auto-configuration so that it is possible to reuse most of the logic if
JPA isn't available at all.
Closes gh-8877
This commit makes sure to honour the `spring.aop.proxy-target-class`
property if set by the user. Previously, the
`MethodValidationPostProcessor` was always configured to use cglib,
regardless of the value of that property.
Closes gh-8869
Previously, as a result of the changes made in de50cfa21e, an
application would fail to start on Google AppEngine as it prevents
the creation of new threads.
This commit updates OnClassCondition so that it falls back to
performing the work on the main thread when its unable to shift it
to a separate thread.
Closes gh-8584
When used as a meta-annotation the value() attribute of
@ConditionalOnClass will fail silently resulting in the @Conditional
nature of the annotation being ignored.
See gh-8185
Previously, WelcomePageHandlerMapping would forward to index.html.
This assumed that the static path pattern was always /**. If it had
been customised to, for example, /foo/**, then the forward would still
be to index.html and a 404 would result as the page is actually
available at /foo/index.html.
At first glance, it would appear that the forward should be made to
foo/index.html. However, as it's a forward rather than a redirect,
any relative URLs in the index.html page would then be resolved using
/ whereas they should be resolved using /foo/. This could be addressed
by using a redirect rather than a forward, but we don't want to do
that as it's more invasive and would require a roundtrip back to the
client. Instead, this commit simply stops performing the forward when
the static path pattern is not /**.
Closes gh-8788
This commit makes sure that `@EnableTransactionManagement` is
auto-configured with Neo4j. It actually reuses what was done in #8434,
making sure that the `Neo4jDataAutoConfiguration` is ordered properly.
Closes gh-8587
Previously to this commit, transaction management was only enabled when
a `DataSource` is configured. The processing of `@Transactional`
annotations are now enabled as long as a `PlatformTransactionManager` is
present.
Also, the `spring.aop.proxy-target-class` is now honoured if set, still
defaulting to CGLIB mode.
Closes gh-8434
As part of the upgrade, this commit removes the use of any API that
has been deprecated in 2.9. This includes the config props endpoint's
use of SerializationFeature.WRITE_NULL_MAP_VALUES. This has been
replaced with configuring serialization inclusion to only include
properties with non-null values. This means that all null-valued
properties will no longer be serialized, not just those that are an
entry in a map.
Closes gh-8604
Closes gh-8537
Closes gh-7695
This commit our Neo4j OGM dependency with the Spring Data Neo4j
snapshots that are currently included in snapshots of Spring Data Kay.
It switches to using Neo4j's Bolt driver by default, aligning it with
the default of the latest Spring Data Neo4j 5 snapshots.
It also contains a workaround for a Neo4j OGM issue [1] and a change
to Neo4jDataAutoConfigurationTests that prevents the entire classpath
from being scanned.
See gh-8687
[1] https://github.com/neo4j/neo4j-ogm/issues/340
As part of the upgrade, this commit removes the use of any API that
has been deprecated in 2.9.0.pr1. This includes the config props
endpoint's use of SerializationFeature.WRITE_NULL_MAP_VALUES. This
has been replaced with configuring serialization inclusion to only
include properties with non-null values. This means that all
null-valued properties will no longer be serialized, not just those
that are an entry in a map.
Closes gh-8604
Closes gh-8537
Restructure `org.springframework.boot.autoconfigure.web` to better align
with the new package structure in `spring-boot`.
Auto-configuration is now split into client, servlet and reactive
sub-packages. In addition a new `http` package now handles common
HTTP concerns.
Fixes gh-8616
Separate logging ApplicationListeners classes to a different package
so that the root `logging` package is no longer aware of `context`
concerns.
Fixes gh-8611
Rework `org.springframework.boot.context.embedded` to relocate classes
to `org.springframework.boot.web`. Packages are now organized around
the following areas:
Packages for shared concerns, for example the `WebServer` interface
to start/stop a server and the common configuration elements:
- org.springframework.boot.web.context
- org.springframework.boot.web.server
Servlet specific packages:
- org.springframework.boot.web.servlet.server
- org.springframework.boot.web.servlet.context
- org.springframework.boot.web.servlet.filter
Reactive specific packages:
- org.springframework.boot.web.reactive.context
- org.springframework.boot.web.reactive.server
Embedded server implementations (both reactive and servlet):
- org.springframework.boot.web.embedded
In addition:
- Rename `EmbeddedServletContainerFactory` to `ServletWebServerFactory`
to align with the `ReactiveWebServerFactory`.
- Rename `EmbeddedWebApplicationContext` to
`ServletWebServerApplicationContext` and
- Rename `EmbeddedReactiveWebApplicationContext` to
`ReactiveWebServerApplicationContext`.
- Add checkstyle rules to restrict imports.
- Fixup all affected code to use the correct imports and local names.
Fixes gh-8532
This commit makes sure that if a `javax.cache.CacheManager` is required,
an auto-configured `HazelcastInstance` is fully resolved first. This
prevents the case where the JCache bootstrap actually starts an instance
early, followed by a second (potentially unwanted) instance created by the
regular auto-configuration.
Since the JCache implementation works with an `HazelcastInstance` behind
the scenes, if there is one `HazelcastInstance` configured and it has a
name, then we configure the `CacheProvider` to use that. Future Hazelcast
version will allow to pass the instance directly (i.e. not requiring an
actual name).
Closes gh-8484
This commit flags the `BeanPostProcessor` registered by the reactive
embedded support as `synthetic` so that it doesn't trigger an early
initialization of other components.
See gh-8467
This commit flags the two `BeanPostProcessors` registered by the
embedded support as `synthetic` so that they don't trigger an early
initialization of other components.
Closes gh-8467