|
|
|
@ -21,6 +21,7 @@ import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
@@ -21,6 +21,7 @@ import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; |
|
|
|
|
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; |
|
|
|
|
import org.springframework.cloud.context.environment.EnvironmentManager; |
|
|
|
@ -31,6 +32,7 @@ import org.springframework.cloud.endpoint.GenericPostableMvcEndpoint;
@@ -31,6 +32,7 @@ import org.springframework.cloud.endpoint.GenericPostableMvcEndpoint;
|
|
|
|
|
import org.springframework.cloud.endpoint.RefreshEndpoint; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
import org.springframework.core.env.ConfigurableEnvironment; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Autoconfiguration for some MVC endpoints governing the application context lifecycle. |
|
|
|
@ -41,42 +43,52 @@ import org.springframework.context.annotation.Configuration;
@@ -41,42 +43,52 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Configuration |
|
|
|
|
@ConditionalOnClass(EnvironmentEndpoint.class) |
|
|
|
|
@ConditionalOnWebApplication |
|
|
|
|
@AutoConfigureAfter({ WebMvcAutoConfiguration.class, |
|
|
|
|
RefreshEndpointAutoConfiguration.class }) |
|
|
|
|
public class LifecycleMvcEndpointAutoConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(EnvironmentEndpoint.class) |
|
|
|
|
@ConditionalOnEnabledEndpoint(value = "env.post") |
|
|
|
|
public EnvironmentManagerMvcEndpoint environmentManagerEndpoint( |
|
|
|
|
EnvironmentEndpoint delegate, EnvironmentManager environment) { |
|
|
|
|
return new EnvironmentManagerMvcEndpoint(delegate, environment); |
|
|
|
|
@ConditionalOnMissingBean |
|
|
|
|
public EnvironmentManager environmentManager(ConfigurableEnvironment environment) { |
|
|
|
|
return new EnvironmentManager(environment); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RefreshEndpoint.class) |
|
|
|
|
public MvcEndpoint refreshMvcEndpoint(RefreshEndpoint endpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(endpoint); |
|
|
|
|
} |
|
|
|
|
@Configuration |
|
|
|
|
@ConditionalOnClass(EnvironmentEndpoint.class) |
|
|
|
|
@ConditionalOnWebApplication |
|
|
|
|
protected static class EndpointConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.class) |
|
|
|
|
public RestartMvcEndpoint restartMvcEndpoint(RestartEndpoint restartEndpoint) { |
|
|
|
|
return new RestartMvcEndpoint(restartEndpoint); |
|
|
|
|
} |
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(EnvironmentEndpoint.class) |
|
|
|
|
@ConditionalOnEnabledEndpoint(value = "env.post") |
|
|
|
|
public EnvironmentManagerMvcEndpoint environmentManagerMvcEndpoint( |
|
|
|
|
EnvironmentEndpoint delegate, EnvironmentManager environment) { |
|
|
|
|
return new EnvironmentManagerMvcEndpoint(delegate, environment); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.PauseEndpoint.class) |
|
|
|
|
public MvcEndpoint pauseMvcEndpoint(RestartEndpoint.PauseEndpoint pauseEndpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(pauseEndpoint); |
|
|
|
|
} |
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RefreshEndpoint.class) |
|
|
|
|
public MvcEndpoint refreshMvcEndpoint(RefreshEndpoint endpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(endpoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.ResumeEndpoint.class) |
|
|
|
|
public MvcEndpoint resumeMvcEndpoint(RestartEndpoint.ResumeEndpoint resumeEndpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(resumeEndpoint); |
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.class) |
|
|
|
|
public RestartMvcEndpoint restartMvcEndpoint(RestartEndpoint restartEndpoint) { |
|
|
|
|
return new RestartMvcEndpoint(restartEndpoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.PauseEndpoint.class) |
|
|
|
|
public MvcEndpoint pauseMvcEndpoint(RestartEndpoint.PauseEndpoint pauseEndpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(pauseEndpoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@ConditionalOnBean(RestartEndpoint.ResumeEndpoint.class) |
|
|
|
|
public MvcEndpoint resumeMvcEndpoint(RestartEndpoint.ResumeEndpoint resumeEndpoint) { |
|
|
|
|
return new GenericPostableMvcEndpoint(resumeEndpoint); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|