Allow lifecycle endpoints to be globally disabled using endpoints.enabled property (#148)
fixes gh-158
This commit is contained in:
committed by
Spencer Gibb
parent
10cbe7e447
commit
63e4e3b8d6
@@ -1,5 +1,10 @@
|
||||
package org.springframework.cloud.autoconfigure;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -10,11 +15,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@@ -44,6 +44,21 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
public void restartMvcEndpointDisabled() {
|
||||
endpointDisabled("endpoints.restart.enabled", "restartMvcEndpoint");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pauseMvcEndpointGloballyDisabled() {
|
||||
endpointDisabled("endpoints.enabled", "pauseMvcEndpoint");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resumeMvcEndpointGloballyDisabled() {
|
||||
endpointDisabled("endpoints.enabled", "resumeMvcEndpoint");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void restartMvcEndpointGloballyDisabled() {
|
||||
endpointDisabled("endpoints.enabled", "restartMvcEndpoint");
|
||||
}
|
||||
|
||||
private void endpointDisabled(String enabledProp, String beanName) {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(Config.class,
|
||||
|
||||
Reference in New Issue
Block a user