This commit moves `@ConfigurationProperties` to the `@Bean` factory
method as this is unusual to put it at class level if it's exposed
that way.

As HealthIndicatorProperties has a constructor, this makes sure that
the annotation processor enables JavaBean binding mode.
This commit is contained in:
Stephane Nicoll 2019-09-09 13:37:54 +02:00
parent 39fed4a9d9
commit 14a676052f
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.health;
import java.util.List;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
@ -30,7 +29,6 @@ import org.springframework.boot.context.properties.DeprecatedConfigurationProper
* @deprecated since 2.2.0 in favor of {@link HealthEndpointProperties}
*/
@Deprecated
@ConfigurationProperties(prefix = "management.health.status")
public class HealthIndicatorProperties {
private final HealthEndpointProperties healthEndpointProperties;

View File

@ -20,6 +20,7 @@ import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -34,6 +35,7 @@ import org.springframework.context.annotation.Configuration;
class LegacyHealthEndpointCompatibiltyConfiguration {
@Bean
@ConfigurationProperties(prefix = "management.health.status")
HealthIndicatorProperties healthIndicatorProperties(HealthEndpointProperties healthEndpointProperties) {
return new HealthIndicatorProperties(healthEndpointProperties);
}