Update `@ConfigurationProperties` constructor binding support to only
apply when a `@ConstructorBinding` annotation is present on either the
type or the specific constructor to use.
Prior to this commit we didn't have a good way to tell when constructor
binding should be used vs regular autowiring.
For convenience, an `@ImmutableConfigurationProperties` meta-annotation
has also been added which is composed of `@ConfigurationProperties` and
`@ConstructorBinding`.
Closes gh-18469
Update `JerseyManagementContextConfiguration` so that customizer beans
are not longer applied. The endpoint resource endpoints are now added
with a registrar bean `@PostConstruct` method.
Prior to this commit, when running the management server on a different
port a `Resource` added by a customizer could be added two different
`ResourceConfig` instance. This breaks the singleton contract expected
by Jersey.
Fixes gh-17801
Co-authored-by: Phillip Webb <pwebb@pivotal.io>
Fix a package tangle that was introduced when we added cache bypass to
`SpringIterableConfigurationPropertySource`. Ideally we should have
been able to depend on `env` from `context` but unfortunately the
`EnvironmentPostProcessor` interface references `SpringApplication`
which needs to use the Binder.
The `isImmutable` method has now been moved to `OriginLookup` which
removes the immediate tangle.
Closes gh-18393
Add an appication context initializer to detect and store the
active RSocket port in the Environment under
`local.rsocket.server.port`.
Additionally add a `@LocalServerPort` that provides a convenient
alternative to `@Value`.
See gh-18287
Co-authored-by: Eddú Meléndez <eddu.melendez@gmail.com>
Extract reactor specific code to an inner class to protect
against ClassNotFound exceptions if reactor is not in use.
Also add support for `Flux`.
See gh-18339
Update `CachingOperationInvoker` so that TTL caching is applied directly
to reactive types. Prior to this commit, a `Mono` would be cached, but
the values that it emitted would not.
See gh-18339
Allow the `LazyInitializationBeanFactoryPostProcessor` to skip setting
lazy-init based on a programmatic callback. This feature allows
downstream projects to deal with edge-cases in which it is not easy to
support lazy-loading (such as in DSLs that dynamically create additional
beans).
See gh-16615
Update `LegacyHealthEndpointCompatibilityConfiguration` to ensure that
the default configuration is only overwritten when the user has
explicitly set new values.
Fixes gh-18354
Add a `show-components` property under `management.endpoint.health` and
`management.endpoint.health.group.<name>` that can be used to change
when components are displayed.
Prior to this commit it was only possible to set `show-details` which
offered an "all or nothing" approach to the resulting JSON. The new
switch allows component information to be displayed whilst still hiding
potentially sensitive details returned from the actual `HealthIndicator`.
Closes gh-15076
Update the health endpoint so the nested components are now exposed
under `components` rather than `details` when v3 of the actuator
REST API is being used.
This distinction helps to clarify the difference between composite
health (health composed of other health components) and health
details (technology specific information gathered by the indicator).
Since this is a breaking change for the REST API, it is only returned
for v3 payloads. Requests made accepting only a v2 response will have
JSON provided in the original form.
Closes gh-17929
Add `ApiVersion` enum that can be injected into actuator endpoints if
they need to support more than one API revision.
Spring MVC, WebFlux and Jersey integrations now detect the API version
based on the HTTP accept header. If the request explicitly accepts a
`application/vnd.spring-boot.actuator.v` media type then the version
is set from the header. If no explicit Spring Boot media type is
accepted then the latest `ApiVersion` is assumed.
A new v3 API revision has also been introduced to allow upcoming health
endpoint format changes. By default all endpoints now consume and
can produce v3, v2 and `application/json` media types.
See gh-17929
Update `DataSourceInitializedPublisher` to fallback to the
`LocalContainerEntityManagerFactoryBean` if the
`javax.persistence.nonJtaDataSource` property is not defined.
As of Hibernate 4.3 the property is no longer set if the `EntityManager`
is created from a `PersistenceUnitInfo` instance rather than actual
properties.
Although this is being addressed in Hibernate issue HHH-13432, it's
not strictly a requirement of the JPA spec that the property is set.
Fixes gh-17061
Allow legacy actuator endpoint IDs that contain dots to be transparently
migrated to the new format. This update will allow Spring Cloud users
to proactively migrate from endpoints such as `hystrix.stream` to
`hystrixstream`.
Closes gh-18148
This will ensure that ReactiveManagementWebSecurityAutoConfiguration backs
off and that the actuator endpoints are also secured via OAuth2.
Fixes gh-17949
Previously, a number of usages of @ConditionalOnMissingBean prevented
a bean that implements an auto-configured bean's "main" interface from
causing the auto-configuration of the bean to back off. This would
happen when @ConditionalOnMissingBean did not specify a type, the
@Bean method returned the bean's concrete type, and that concreate
type implements a "main" interface.
This commit updates such usages of @ConditionalOnMissingBean to
specify the "main" interface as the type of the bean that must be
missing. This will allow, for example, the auto-configured
MongoTemplate bean to back off when a MongoOperations bean is defined.
Fixes gh-18101
Restore `HealthIndicatorRegistry` and `ReactiveHealthIndicatorRegistry`
auto-configured beans with a version that adapts to the new contributor
interfaces.
Closes gh-16903
Add support for a `spring.banner.image.pixelmode` property which can
be set to `block` to use unicode block characters when rendering image
banners.
Closes gh-18301
Update `ApplicationContextRequestMatcher` to ensure that the `matches`
method is never called before `initialized`. This fixes an issue
accidentally introduced in commit 5938ca78 where concurrent calls
to `matches` could trigger unexpected errors due to the fact that the
second call proceeded before the `initialized` method had returned.
Fixes gh-18211
Refactor the `org.springframework.boot.actuate.context` package
with the following changes:
- Deprecate several classes which would ideally be internal
- Replace `ConfigurationBeanFactoryMetadata` with a new
`ConfigurationPropertiesBean` class to better reflect that we no
longer maintain meta-data directly.
- Use constructor injection and final fields whenever possible
- Rename `ConfiguraionPropertiesBeanDefinition` to
`ConfigurationPropertiesValueObjectBeanDefinition` to align
with the binder changes made in commit 0b3015e4ff
- Add additional tests
Closes gh-16903
This commit warns developers about the fact that plugging RSocket into
an existing web server is only possible with Reactor Netty web servers.
RSocket itself is using Reactor Netty, so this is why we can plug an
RSocket over websocket handler in an existing Reactor Netty handler.
This feature is not possible with other web servers, as existing APIs do
not make that possible.
Fixes gh-17494
After a change in Spring Framework (see
spring-projects/spring-framework#23314), the `RouteMatcher` to be used
with the RSocket infrastructure is configured on the `RSocketStrategies`
directly.
This commit moves the auto-configuration of the
`PathPatternRouteMatcher` from the message handling parts to the RSocket
strategy one.
Closes gh-17571
Prior to this commit, Spring Boot would use `Schedulers.elastic()` when
required to process blocking tasks in a reactive environment.
reactor/reactor-core#1804 introduced a new scheduler,
`Schedulers.boundedElastic()` that behaves quite similarly but:
* will limit the number of workers thread
* will queue tasks if no worker thread is available and reject them is
the queue is exceeds a limit
This allows Spring Boot to schedule blocking tasks as before and allows
greater flexibility.
Fixes gh-18269
See gh-18276
Previously, Reactor Netty was the only embedded server that enabled
H2C by default. This commit updates the factory to only enable HTTP/2
when SSL has also been configured, aligning it with Jetty, Tomcat,
and Undertow.
If H2C is required, it can be enabled using a NettyServerCustomizer:
@Bean
NettyServerCustomizer h2cCustomizer() {
return (httpServer) ->
httpServer.protocol(HttpProtocol.HTTP11, HttpProtocol.H2C);
}
Closes gh-17867
This commit makes sure that any subsequent call on addProtocolResolver
on the context will impact the ResourceLoader implementation that
DevTools sets on the context.
This makes sure that any custom ProtocolResolver that is set later in
the lifecycle is taken into account.
Closes gh-17214
Prior to this change, the custom port configured for the RSocket
server would not be used if the server factory is using the
websocket transport and is provided with a custom
`ReactorResourceFactory`.
Fixes gh-18200
This new property allows to customize `fileNamePattern` if it is set.
Otherwise, a default pattern remains. Also, new property is supported
`logging.pattern.rolling-file-name`.
See gh-18151
Previously, the upgrade to Flyway 6 broke compatibility with Flyway
5.2 due to the use of method references that refer to two methods
that do not exist in Flyway 5.2.
This commit replaces the method references with lambdas that are only
called if the user sets the related property. Unless a new-in-Flyway-6
property is set, the auto-configuration will work as before. When such
a property is set the auto-configuration will fail with a
NoSuchMethodError. This approach was chosen to make the
incompatibility clear.
We have also introduced support for passing any JavaMigration beans
in the context into Flyway. This too relies on API that is new in
Flyway 6. It is possible (although unlikely) that users had
JavaMigration beans in Spring Boot 2.1 that were being ignored. This
commit restores this behaviour when using Flyway 5.2.
Closes gh-18193
This commit applies `ServerRSocketFactoryCustomizer` beans to RSocket
setups when the RSocket server is being plugged into an existing Reactor
Netty web server.
Fixes gh-18208
Update configuration properties support to allow the `@Component`
annotation to be used on `@ConfigurationProperties` beans as long
as they are mutable.
This restores the behavior of Spring Boot 2.1 for mutable beans whilst
still allowing us to enforce the stricter rules for immutable value
object configuration properties.
Closes gh-18138