This commit is contained in:
Phillip Webb
2015-11-09 21:09:19 -08:00
parent aa8d0dd072
commit 332c6911cf
6 changed files with 60 additions and 56 deletions

View File

@@ -36,6 +36,14 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo
private String path = "/docs";
/**
* Enable the endpoint.
*/
private boolean enabled = true;
/**
* Mark if the endpoint exposes sensitive information.
*/
private boolean sensitive;
private final ManagementServletContext managementServletContext;
@@ -78,8 +86,12 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo
return this.path;
}
public void setSensitive(boolean sensitive) {
this.sensitive = sensitive;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
@@ -87,6 +99,10 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo
return this.sensitive;
}
public void setSensitive(boolean sensitive) {
this.sensitive = sensitive;
}
@Override
public Class<? extends Endpoint<?>> getEndpointType() {
return null;

View File

@@ -37,8 +37,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* @since 1.3.0
*/
@ConfigurationProperties("endpoints.actuator")
public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter
implements MvcEndpoint {
public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpoint {
/**
* Endpoint URL path.
@@ -47,16 +46,16 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter
@Pattern(regexp = "^$|/[^/]*", message = "Path must be empty or start with /")
private String path;
/**
* Enable security on the endpoint.
*/
private boolean sensitive = false;
/**
* Enable the endpoint.
*/
private boolean enabled = true;
/**
* Mark if the endpoint exposes sensitive information.
*/
private boolean sensitive = false;
private final ManagementServletContext managementServletContext;
public HalJsonMvcEndpoint(ManagementServletContext managementServletContext) {
@@ -86,6 +85,14 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter
return this.path;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean isSensitive() {
return this.sensitive;
@@ -95,14 +102,6 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter
this.sensitive = sensitive;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public Class<? extends Endpoint<?>> getEndpointType() {
return null;

View File

@@ -57,16 +57,16 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
@Pattern(regexp = "/[^?#]*", message = "Path must start with /")
private String path = "/jolokia";;
/**
* Enable security on the endpoint.
*/
private boolean sensitive = true;
/**
* Enable the endpoint.
*/
private boolean enabled = true;
/**
* Mark if the endpoint exposes sensitive information.
*/
private boolean sensitive = true;
private final ServletWrappingController controller = new ServletWrappingController();
public JolokiaMvcEndpoint() {
@@ -102,15 +102,6 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
this.enabled = enabled;
}
@Override
public String getPath() {
return this.path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public boolean isSensitive() {
return this.sensitive;
@@ -120,6 +111,15 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
this.sensitive = sensitive;
}
@Override
public String getPath() {
return this.path;
}
public void setPath(String path) {
this.path = path;
}
@Override
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {

View File

@@ -59,16 +59,16 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware {
@Pattern(regexp = "/[^/]*", message = "Path must start with /")
private String path = "/logfile";
/**
* Enable security on the endpoint.
*/
private boolean sensitive = true;
/**
* Enable the endpoint.
*/
private boolean enabled = true;
/**
* Mark if the endpoint exposes sensitive information.
*/
private boolean sensitive = true;
private Environment environment;
@Override
@@ -85,6 +85,14 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware {
this.path = path;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean isSensitive() {
return this.sensitive;
@@ -94,14 +102,6 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware {
this.sensitive = sensitive;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {

View File

@@ -67,4 +67,5 @@ public class ManagementErrorEndpoint implements MvcEndpoint {
public Class<? extends Endpoint> getEndpointType() {
return null;
}
}

View File

@@ -17,24 +17,12 @@
"sourceType": "org.springframework.boot.actuate.endpoint.EnvironmentEndpoint",
"description": "Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions."
},
{
"name": "endpoints.docs.enabled",
"type": "java.lang.Boolean",
"description": "Enable actuator docs endpoint.",
"defaultValue": true
},
{
"name": "endpoints.jmx.enabled",
"type": "java.lang.Boolean",
"description": "Enable JMX export of all endpoints.",
"defaultValue": true
},
{
"name": "endpoints.jolokia.enabled",
"type": "java.lang.Boolean",
"description": "Enable Jolokia endpoint.",
"defaultValue": true
},
{
"name": "info",
"type": "java.util.Map<java.lang.String,java.lang.Object>",