Polish
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:
parent
39fed4a9d9
commit
14a676052f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue