Add property description

Set the field javadoc of many properties that are managed via
configuration so that the "description" field is available in the
meta-data.

Closes gh-1808
This commit is contained in:
Stephane Nicoll
2014-11-25 11:20:37 +01:00
parent 40a7445fec
commit 65e9d6a6e0
48 changed files with 767 additions and 31 deletions

View File

@@ -30,11 +30,20 @@ import org.springframework.util.StringUtils;
@ConfigurationProperties(prefix = "endpoints.jmx")
public class EndpointMBeanExportProperties {
/**
* JMX domain name. Initialized with the value of 'spring.jmx.default-domain' if set.
*/
@Value("${spring.jmx.default_domain:}")
private String domain;
/**
* Ensure that ObjectNames are modified in case of conflict.
*/
private boolean uniqueNames = false;
/**
* Enable the JMX endpoints.
*/
private boolean enabled = true;
private Properties staticNames = new Properties();

View File

@@ -29,6 +29,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("management.health.status")
public class HealthIndicatorAutoConfigurationProperties {
/**
* Comma-separated list of health statuses in order of severity.
*/
private List<String> order = null;
public List<String> getOrder() {

View File

@@ -32,6 +32,10 @@ import org.springframework.http.HttpStatus;
@ConfigurationProperties(prefix = "endpoints.health")
public class HealthMvcEndpointProperties {
/**
* Mapping of health statuses to HttpStatus codes. By default, registered
* health statuses map to sensible defaults (i.e. UP maps to 200).
*/
private Map<String, HttpStatus> mapping = new HashMap<String, HttpStatus>();
public Map<String, HttpStatus> getMapping() {

View File

@@ -30,6 +30,10 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "jolokia")
public class JolokiaProperties {
/**
* Jolokia settings. These are traditionally set using servlet parameters, refer
* to the documentation of Jolokia for more details.
*/
private Map<String, String> config = new HashMap<String, String>();
public Map<String, String> getConfig() {

View File

@@ -53,13 +53,25 @@ public class ManagementServerProperties implements SecurityPrequisite {
*/
public static final int ACCESS_OVERRIDE_ORDER = ManagementServerProperties.BASIC_AUTH_ORDER - 1;
/**
* Management endpoint HTTP port. Use the same port as the applicationby default.
*/
private Integer port;
/**
* Network address that the management endpoints should bind to.
*/
private InetAddress address;
/**
* Management endpoint context-path.
*/
@NotNull
private String contextPath = "";
/**
* Add the "X-Application-Context" HTTP header in each response.
*/
private boolean addApplicationContextHeader = true;
private final Security security = maybeCreateSecurity();
@@ -114,10 +126,19 @@ public class ManagementServerProperties implements SecurityPrequisite {
*/
public static class Security {
/**
* Enable security.
*/
private boolean enabled = true;
/**
* Role required to access the management endpoint.
*/
private String role = "ADMIN";
/**
* Session creating policy to use (always, never, if_required, stateless).
*/
private SessionCreationPolicy sessions = SessionCreationPolicy.STATELESS;
public SessionCreationPolicy getSessions() {

View File

@@ -41,6 +41,11 @@ public class ShellProperties {
private static Log logger = LogFactory.getLog(ShellProperties.class);
/**
* Authentication type (can be "simple", "spring", "key" or "jaas"). Auto-detected
* according to the environment (i.e. if Spring Security is available, "spring" is used by
* default).
*/
private String auth = "simple";
private boolean defaultAuth = true;
@@ -48,15 +53,31 @@ public class ShellProperties {
@Autowired(required = false)
private CrshShellProperties[] additionalProperties = new CrshShellProperties[] { new SimpleAuthenticationProperties() };
/**
* Scan for changes and update the command if necessary (in seconds).
*/
private int commandRefreshInterval = -1;
/**
* Patterns to use to look for commands.
*/
private String[] commandPathPatterns = new String[] { "classpath*:/commands/**",
"classpath*:/crash/commands/**" };
/**
* Patterns to use to look for configurations.
*/
private String[] configPathPatterns = new String[] { "classpath*:/crash/*" };
/**
* Comma-separated list of commands to disable.
*/
private String[] disabledCommands = new String[] { "jpa*", "jdbc*", "jndi*" };
/**
* Comma-separated list of plugins to disable. Certain plugins are disabled
* by default based on the environment.
*/
private String[] disabledPlugins = new String[0];
private final Ssh ssh = new Ssh();
@@ -207,10 +228,19 @@ public class ShellProperties {
*/
public static class Ssh extends CrshShellProperties {
/**
* Enable CRaSH SSH support.
*/
private boolean enabled = true;
/**
* Path to the SSH server key.
*/
private String keyPath;
/**
* SSH port.
*/
private String port = "2000";
@Override
@@ -256,9 +286,15 @@ public class ShellProperties {
*/
public static class Telnet extends CrshShellProperties {
/**
* Enable CRaSH telnet support. Enabled by default if the TelnetPlugin is available.
*/
private boolean enabled = ClassUtils.isPresent("org.crsh.telnet.TelnetPlugin",
ClassUtils.getDefaultClassLoader());
/**
* Telnet port.
*/
private String port = "5000";
@Override
@@ -294,6 +330,9 @@ public class ShellProperties {
public static class JaasAuthenticationProperties extends
CrshShellAuthenticationProperties {
/**
* JAAS domain.
*/
private String domain = "my-domain";
@Override
@@ -320,6 +359,9 @@ public class ShellProperties {
public static class KeyAuthenticationProperties extends
CrshShellAuthenticationProperties {
/**
* Path to the authentication key. This should point to a valid ".pem" file.
*/
private String path;
@Override
@@ -374,8 +416,14 @@ public class ShellProperties {
public static class User {
/**
* Login user.
*/
private String name = "user";
/**
* Login password.
*/
private String password = UUID.randomUUID().toString();
private boolean defaultPassword = true;
@@ -417,6 +465,9 @@ public class ShellProperties {
public static class SpringAuthenticationProperties extends
CrshShellAuthenticationProperties {
/**
* Comma-separated list of required roles to login to the CRaSH console.
*/
private String[] roles = new String[] { "ADMIN" };
@Override

View File

@@ -27,12 +27,22 @@ import javax.validation.constraints.Pattern;
*/
public abstract class AbstractEndpoint<T> implements Endpoint<T> {
/**
* Endpoint identifier. With HTTP monitoring the identifier
* of the endpoint is mapped to a URL (e.g. 'foo' is mapped to '/foo').
*/
@NotNull
@Pattern(regexp = "\\w+", message = "ID must only contains letters, numbers and '_'")
private String id;
/**
* Enable security on the endpoint.
*/
private boolean sensitive;
/**
* Enable the endpoint.
*/
private boolean enabled = true;
public AbstractEndpoint(String id) {

View File

@@ -37,6 +37,9 @@ public class HealthEndpoint extends AbstractEndpoint<Health> {
private final HealthIndicator healthIndicator;
/**
* Time to live for cached result, in milliseconds.
*/
private long timeToLive = 1000;
/**

View File

@@ -38,7 +38,7 @@ class Sanitizer {
}
/**
* Set the keys that should be sanitize. Keys can be simple strings that the property
* Keys that should be sanitized. Keys can be simple strings that the property
* ends with or regex expressions.
* @param keysToSanitize the keys to sanitize
*/

View File

@@ -47,12 +47,21 @@ import org.springframework.web.util.UrlPathHelper;
public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
ApplicationContextAware, ServletContextAware {
/**
* Endpoint URL path.
*/
@NotNull
@Pattern(regexp = "/[^/]*", message = "Path must start with /")
private String path;
/**
* Enable security on the endpoint.
*/
private boolean sensitive;
/**
* Enable the endpoint.
*/
private boolean enabled = true;
private final ServletWrappingController controller = new ServletWrappingController();

View File

@@ -34,8 +34,14 @@ public class DiskSpaceHealthIndicatorProperties {
private static final int DEFAULT_THRESHOLD = 10 * MEGABYTES;
/**
* Path used to compute the available disk space.
*/
private File path = new File(".");
/**
* Minimum disk space that should be available, in bytes.
*/
private long threshold = DEFAULT_THRESHOLD;
public File getPath() {

View File

@@ -3,13 +3,13 @@
"name": "endpoints.configprops.keys-to-sanitize",
"type": "java.lang.String",
"sourceType": "org.springframework.boot.actuate.endpoint.ConfigurationPropertiesReportEndpoint",
"description": "The keys that should be sanitize. Keys can be simple strings that the property ends with or regex expressions."
"description": "Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions."
},
{
"name": "endpoints.env.keys-to-sanitize",
"type": "java.lang.String",
"sourceType": "org.springframework.boot.actuate.endpoint.EnvironmentEndpoint",
"description": "The keys that should be sanitize. Keys can be simple strings that the property ends with or regex expressions."
"description": "Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions."
},
{
"name": "info",
@@ -60,7 +60,7 @@
{
"name": "spring.pidfile",
"type": "java.lang.String",
"description": "The location of the PID file to write (if ApplicationPidFileWriter is used).",
"description": "Location of the PID file to write (if ApplicationPidFileWriter is used).",
"sourceType": "org.springframework.boot.actuate.system.ApplicationPidFileWriter"
}
]}