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"
}
]}

View File

@ -59,10 +59,22 @@ public class MessageSourceAutoConfiguration {
private static final Resource[] NO_RESOURCES = {};
/**
* Comma-separated list of basenames, each following the ResourceBundle convention. Essentially
* a fully-qualified classpath location. If it doesn't contain a package qualifier (such as
* "org.mypackage"), it will be resolved from the classpath root.
*/
private String basename = "messages";
/**
* Message bundles encoding.
*/
private String encoding = "utf-8";
/**
* Loaded resource bundle files cache expiration, in seconds. When set to
* -1, bundles are cached forever.
*/
private int cacheSeconds = -1;
@Bean

View File

@ -31,16 +31,34 @@ import org.springframework.util.StringUtils;
@ConfigurationProperties(prefix = "spring.rabbitmq")
public class RabbitProperties {
/**
* RabbitMQ host.
*/
private String host = "localhost";
/**
* RabbitMQ port.
*/
private int port = 5672;
/**
* Login user to authenticate to the broker.
*/
private String username;
/**
* Login to authenticate against the broker.
*/
private String password;
/**
* Virtual host to use when connecting to the broker.
*/
private String virtualHost;
/**
* Comma-separated list of addresses to which the client should connect to.
*/
private String addresses;
private boolean dynamic = true;

View File

@ -30,6 +30,9 @@ public class BatchProperties {
private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/"
+ "batch/core/schema-@@platform@@.sql";
/**
* Path to the SQL file to use to initialize the database schema.
*/
private String schema = DEFAULT_SCHEMA_LOCATION;
private final Initializer initializer = new Initializer();
@ -54,6 +57,9 @@ public class BatchProperties {
public static class Initializer {
/**
* Create the required batch tables on startup if necessary.
*/
private boolean enabled = true;
public boolean isEnabled() {
@ -68,6 +74,10 @@ public class BatchProperties {
public static class Job {
/**
* Comma-separated list of job names to execute on startup. By default, all Jobs
* found in the context are executed.
*/
private String names = "";
public String getNames() {

View File

@ -28,8 +28,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.data.elasticsearch")
public class ElasticsearchProperties {
/**
* Elasticsearch cluster name.
*/
private String clusterName = "elasticsearch";
/**
* Comma-separated list of cluster node addresses. If not specified, starts a client node.
*/
private String clusterNodes;
public String getClusterName() {

View File

@ -35,18 +35,40 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "flyway", ignoreUnknownFields = true)
public class FlywayProperties {
/**
* Locations of migrations scripts.
*/
private List<String> locations = Arrays.asList("db/migration");
/**
* Check that migration scripts location exists.
*/
private boolean checkLocation = false;
/**
* Enable flyway.
*/
private boolean enabled = true;
/**
* Login user of the database to migrate.
*/
private String user;
/**
*Login password of the database to migrate.
*/
private String password;
/**
* JDBC url of the database to migrate. If not set, the primary configured
* data source is used.
*/
private String url;
/**
* SQL statements to execute to initialize a connection immediately after obtaining it.
*/
private List<String> initSqls = Collections.emptyList();
public void setLocations(List<String> locations) {

View File

@ -38,8 +38,14 @@ public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties
public static final String DEFAULT_SUFFIX = ".ftl";
/**
* Well-known FreeMarker keys which will be passed to FreeMarker's Configuration.
*/
private Map<String, String> settings = new HashMap<String, String>();
/**
* Comma-separated list of template paths.
*/
private String[] templateLoaderPath = new String[] { DEFAULT_TEMPLATE_LOADER_PATH };
public FreeMarkerProperties() {

View File

@ -35,10 +35,19 @@ public class GroovyTemplateProperties extends AbstractViewResolverProperties {
public static final String DEFAULT_SUFFIX = ".tpl";
/**
* Prefix that gets prepended to view names when building a URL.
*/
private String prefix = DEFAULT_PREFIX;
/**
*Suffix that gets appended to view names when building a URL.
*/
private String suffix = DEFAULT_SUFFIX;
/**
* Configuration to pass to TemplateConfiguration.
*/
private Map<String, Object> configuration = new HashMap<String, Object>();
public String getPrefix() {

View File

@ -37,18 +37,40 @@ import com.fasterxml.jackson.databind.SerializationFeature;
@ConfigurationProperties(prefix = "spring.jackson")
public class JacksonProperties {
/**
* Date format string (yyyy-MM-dd HH:mm:ss), or a fully-qualified date format class name.
*/
private String dateFormat;
/**
* One of the constants on Jackson's PropertyNamingStrategy (CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES).
* Can also be a fully-qualified class name of a PropertyNamingStrategy subclass.
*/
private String propertyNamingStrategy;
/**
* Jackson on/off features that affect the way Java objects are serialized.
*/
private Map<SerializationFeature, Boolean> serialization = new HashMap<SerializationFeature, Boolean>();
/**
* Jackson on/off features that affect the way Java objects are deserialized.
*/
private Map<DeserializationFeature, Boolean> deserialization = new HashMap<DeserializationFeature, Boolean>();
/**
* Jackson general purpose on/off features.
*/
private Map<MapperFeature, Boolean> mapper = new HashMap<MapperFeature, Boolean>();
/**
* Jackson on/off features for parsers.
*/
private Map<JsonParser.Feature, Boolean> parser = new HashMap<JsonParser.Feature, Boolean>();
/**
* Jackson on/off features for generators.
*/
private Map<JsonGenerator.Feature, Boolean> generator = new HashMap<JsonGenerator.Feature, Boolean>();
public String getDateFormat() {

View File

@ -39,30 +39,66 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
public static final String PREFIX = "spring.datasource";
/**
* Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
*/
private String driverClassName;
/**
* JDBC url of the database.
*/
private String url;
/**
* Login user of the database.
*/
private String username;
/**
* Login password of the database.
*/
private String password;
private ClassLoader classLoader;
/**
* JNDI location of the datasource. Class, url, username & password are ignored when set.
*/
private String jndiName;
/**
* Populate the database using 'data.sql'.
*/
private boolean initialize = true;
/**
* Platform to use in the schema resource (schema-${platform}.sql).
*/
private String platform = "all";
/**
* Schema (DDL) script resource reference.
*/
private String schema;
/**
* Data (DML) script resource reference.
*/
private String data;
/**
* Do not stop if an error occurs while initializing the database.
*/
private boolean continueOnError = false;
/**
* Statement separator in SQL initialization scripts.
*/
private String separator = ";";
/**
* SQL scripts encoding.
*/
private String sqlScriptEncoding;
private EmbeddedDatabaseConnection embeddedDatabaseConnection = EmbeddedDatabaseConnection.NONE;
@ -244,8 +280,14 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
*/
public static class Xa {
/**
* XA datasource fully qualified name.
*/
private String dataSourceClassName;
/**
* Properties to pass to the XA data source.
*/
private Map<String, String> properties = new LinkedHashMap<String, String>();
public String getDataSourceClassName() {

View File

@ -30,8 +30,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("spring.jersey")
public class JerseyProperties {
/**
* Jersey integration type. Can be either "servlet" or "filter".
*/
private Type type = Type.SERVLET;
/**
* Init parameters to pass to Jersey.
*/
private Map<String, String> init = new HashMap<String, String>();
private Filter filter = new Filter();
@ -66,6 +72,9 @@ public class JerseyProperties {
public static class Filter {
/**
* Jersey filter chain order.
*/
private int order;
public int getOrder() {

View File

@ -27,8 +27,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.jms")
public class JmsProperties {
/**
* Specify if the default destination type is topic.
*/
private boolean pubSubDomain = false;
/**
* Connection factory JNDI name. When set, takes precedence to others connection
* factory auto-configurations.
*/
private String jndiName;
public boolean isPubSubDomain() {

View File

@ -27,14 +27,30 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.activemq")
public class ActiveMQProperties {
/**
* URL of the ActiveMQ broker. Auto-generated by default.
*/
private String brokerUrl;
/**
* Specify if the default broker URL should be in memory. Ignored if an explicit
* broker has been specified.
*/
private boolean inMemory = true;
/**
* Specify if a PooledConnectionFactory should be created instead of a regular ConnectionFactory.
*/
private boolean pooled;
/**
* Login user of the broker.
*/
private String user;
/**
* Login password of the broker.
*/
private String password;
public String getBrokerUrl() {
@ -45,10 +61,6 @@ public class ActiveMQProperties {
this.brokerUrl = brokerUrl;
}
/**
* Specify if the default broker url should be in memory. Ignored if an explicit
* broker has been specified.
*/
public boolean isInMemory() {
return this.inMemory;
}

View File

@ -33,10 +33,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.hornetq")
public class HornetQProperties {
/**
* HornetQ deployment mode, auto-detected by default. Can be explicitly set to "native" or "embedded".
*/
private HornetQMode mode;
/**
* HornetQ broker host.
*/
private String host = "localhost";
/**
* HornetQ broker port.
*/
private int port = 5445;
private final Embedded embedded = new Embedded();
@ -76,18 +85,39 @@ public class HornetQProperties {
private static final AtomicInteger serverIdCounter = new AtomicInteger();
/**
* Server id. By default, an auto-incremented counter is used.
*/
private int serverId = serverIdCounter.getAndIncrement();
/**
* Enable embedded mode if the HornetQ server APIs are available.
*/
private boolean enabled = true;
/**
* Enable persistent store.
*/
private boolean persistent;
/**
* Journal file directory. Not necessary if persistence is turned off.
*/
private String dataDirectory;
/**
* Comma-separate list of queues to create on startup.
*/
private String[] queues = new String[0];
/**
* Comma-separate list of topics to create on startup.
*/
private String[] topics = new String[0];
/**
* Cluster password. Randomly generated on startup by default
*/
private String clusterPassword = UUID.randomUUID().toString();
private boolean defaultClusterPassword = true;

View File

@ -34,8 +34,14 @@ public class JtaProperties {
public static final String PREFIX = "spring.jta";
/**
* Transaction logs directory.
*/
private String logDir;
/**
* Transaction manager unique identifier.
*/
private String transactionManagerId;
public void setLogDir(String logDir) {

View File

@ -31,23 +31,51 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "liquibase", ignoreUnknownFields = false)
public class LiquibaseProperties {
/**
* Change log configuration path.
*/
@NotNull
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
/**
* Check the change log location exists.
*/
private boolean checkChangeLogLocation = true;
/**
* Comma-separated list of runtime contexts to use.
*/
private String contexts;
/**
* Default database schema.
*/
private String defaultSchema;
/**
* Drop the database schema first.
*/
private boolean dropFirst;
/**
* Enable liquibase support.
*/
private boolean enabled = true;
/**
* Login user of the database to migrate.
*/
private String user;
/**
* Login password of the database to migrate.
*/
private String password;
/**
* JDBC url of the database to migrate. If not set, the primary configured
* data source is used.
*/
private String url;
public String getChangeLog() {

View File

@ -31,16 +31,34 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.mail")
public class MailProperties {
/**
* SMTP server host.
*/
private String host;
/**
* SMTP server port.
*/
private Integer port;
/**
* Login user of the SMTP server.
*/
private String username;
/**
* Login password of the SMTP server.
*/
private String password;
/**
* Default MimeMessage encoding.
*/
private String defaultEncoding = "UTF-8";
/**
* Additional JavaMail session properties.
*/
private Map<String, String> properties = new HashMap<String, String>();
public String getHost() {

View File

@ -27,16 +27,34 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("spring.mobile.devicedelegatingviewresolver")
public class DeviceDelegatingViewResolverProperties {
/**
* Prefix that gets prepended to view names for normal devices.
*/
private String normalPrefix = "";
/**
* Suffix that gets appended to view names for normal devices.
*/
private String normalSuffix = "";
/**
* Prefix that gets prepended to view names for mobile devices.
*/
private String mobilePrefix = "mobile/";
/**
* Suffix that gets appended to view names for mobile devices.
*/
private String mobileSuffix = "";
/**
* Prefix that gets prepended to view names for tablet devices.
*/
private String tabletPrefix = "tablet/";
/**
* Suffix that gets appended to view names for tablet devices.
*/
private String tabletSuffix = "";
public String getNormalPrefix() {

View File

@ -42,20 +42,44 @@ public class MongoProperties {
private static final int DEFAULT_PORT = 27017;
/**
* Mongo server host.
*/
private String host;
/**
* Mongo server port.
*/
private Integer port = null;
/**
* Mmongo database URI. When set, host and port are ignored.
*/
private String uri = "mongodb://localhost/test";
/**
* Database name.
*/
private String database;
/**
* Authentication database name.
*/
private String authenticationDatabase;
/**
* GridFS database name.
*/
private String gridFsDatabase;
/**
* Login user of the mongo server.
*/
private String username;
/**
* Login password of the mongo server.
*/
private char[] password;
public String getHost() {

View File

@ -40,14 +40,31 @@ public class JpaProperties {
private static final Log logger = LogFactory.getLog(JpaProperties.class);
/**
* Additional native properties to set on the JPA provider.
*/
private Map<String, String> properties = new HashMap<String, String>();
/**
* Name of the target database to operate on, auto-detected by default. Can be
* alternatively set using the "Database" enum.
*/
private String databasePlatform;
/**
* Target database to operate on, auto-detected by default. Can be alternatively
* set using the "databasePlatform" property.
*/
private Database database = Database.DEFAULT;
/**
* Initialize the schema on startup.
*/
private boolean generateDdl = false;
/**
* Enable logging of SQL statements.
*/
private boolean showSql = false;
private Hibernate hibernate = new Hibernate();
@ -114,8 +131,16 @@ public class JpaProperties {
private static final String DEFAULT_NAMING_STRATEGY = "org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy";
/**
* Naming strategy fully qualified name.
*/
private Class<?> namingStrategy;
/**
* DDL mode ("none", "validate", "update", "create", "create-drop"). This is actually a shortcut
* for the "hibernate.hbm2ddl.auto" property. Default to "create-drop" when using an embedded database,
* "none" otherwise.
*/
private String ddlAuto;
public Class<?> getNamingStrategy() {

View File

@ -27,12 +27,24 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.redis")
public class RedisProperties {
/**
* Database index used by the connection factory.
*/
private int database = 0;
/**
* Redis server host.
*/
private String host = "localhost";
/**
* Login password of the redis server.
*/
private String password;
/**
* Redis server port.
*/
private int port = 6379;
private Pool pool;
@ -92,12 +104,29 @@ public class RedisProperties {
*/
public static class Pool {
/**
* Max number of "idle" connections in the pool. Use a negative value to indicate
* an unlimited number of idle connections.
*/
private int maxIdle = 8;
/**
* Target for the minimum number of idle connections to maintain in
* the pool. This setting only has an effect if it is positive.
*/
private int minIdle = 0;
/**
* Max number of connections that can be allocated by the pool at a given time. Use
* a negative value for no limit.
*/
private int maxActive = 8;
/**
* Maximum amount of time (in milliseconds) a connection allocation should block before
* throwing an exception when the pool is exhausted. Use a negative value to block
* indefinitely.
*/
private int maxWait = -1;
public int getMaxIdle() {
@ -138,8 +167,14 @@ public class RedisProperties {
*/
public static class Sentinel {
/**
* Name of Redis server.
*/
private String master;
/**
* Comma-separated list of host:port pairs.
*/
private String nodes;
public String getMaster() {

View File

@ -60,8 +60,14 @@ public class SecurityProperties implements SecurityPrequisite {
*/
public static final int DEFAULT_FILTER_ORDER = 0;
/**
* Enable secure channel for all requests.
*/
private boolean requireSsl;
/**
* Enable Cross Site Request Forgery support.
*/
// Flip this when session creation is disabled by default
private boolean enableCsrf = false;
@ -69,12 +75,21 @@ public class SecurityProperties implements SecurityPrequisite {
private final Headers headers = new Headers();
/**
* Session creation policy (always, never, if_required, stateless).
*/
private SessionCreationPolicy sessions = SessionCreationPolicy.STATELESS;
/**
* Comma-separated list of paths to exclude from the default secured paths.
*/
private List<String> ignored = new ArrayList<String>();
private final User user = new User();
/**
* Security filter chain order.
*/
private int filterOrder = DEFAULT_FILTER_ORDER;
public Headers getHeaders() {
@ -139,14 +154,29 @@ public class SecurityProperties implements SecurityPrequisite {
NONE, DOMAIN, ALL
}
/**
* Enable cross site scripting (XSS) protection.
*/
private boolean xss;
/**
* Enable cache control HTTP headers.
*/
private boolean cache;
/**
* Enable "X-Frame-Options" header.
*/
private boolean frame;
/**
* Enable "X-Content-Type-Options" header.
*/
private boolean contentType;
/**
* HTTP Strict Transport Security (HSTS) mode (none, domain, all).
*/
private HSTS hsts = HSTS.ALL;
public boolean isXss() {
@ -193,10 +223,19 @@ public class SecurityProperties implements SecurityPrequisite {
public static class Basic {
/**
* Enable basic authentication.
*/
private boolean enabled = true;
/**
* HTTP basic realm name.
*/
private String realm = "Spring";
/**
* Comma-separated list of paths to secure.
*/
private String[] path = new String[] { "/**" };
public boolean isEnabled() {
@ -227,10 +266,19 @@ public class SecurityProperties implements SecurityPrequisite {
public static class User {
/**
* Default user name.
*/
private String name = "user";
/**
* Password for the default user name.
*/
private String password = UUID.randomUUID().toString();
/**
* Granted roles for the default user name.
*/
private List<String> role = new ArrayList<String>(Arrays.asList("USER"));
private boolean defaultPassword = true;

View File

@ -26,8 +26,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
*/
abstract class SocialProperties {
/**
* Application id.
*/
private String appId;
/**
* Application secret.
*/
private String appSecret;
public String getAppId() {

View File

@ -27,8 +27,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.data.solr")
public class SolrProperties {
/**
* Solr host. Ignored if "zk-host" is set.
*/
private String host = "http://127.0.0.1:8983/solr";
/**
* ZooKeeper host address in the form HOST:PORT.
*/
private String zkHost;
public String getHost() {

View File

@ -31,18 +31,39 @@ import org.springframework.web.servlet.view.AbstractTemplateViewResolver;
public abstract class AbstractTemplateViewResolverProperties extends
AbstractViewResolverProperties {
/**
* Prefix that gets prepended to view names when building a URL.
*/
private String prefix;
/**
* Suffix that gets appended to view names when building a URL.
*/
private String suffix;
/**
* Name of the RequestContext attribute for all views.
*/
private String requestContextAttribute;
/**
* Set whether all request attributes should be added to the model prior to merging with the template.
*/
private boolean exposeRequestAttributes = false;
/**
* Set whether all HttpSession attributes should be added to the model prior to merging with the template.
*/
private boolean exposeSessionAttributes = false;
/**
* Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.
*/
private boolean allowRequestOverride = false;
/**
* Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext".
*/
private boolean exposeSpringMacroHelpers = true;
protected AbstractTemplateViewResolverProperties(String defaultPrefix,

View File

@ -29,14 +29,29 @@ import org.springframework.web.servlet.ViewResolver;
*/
public abstract class AbstractViewResolverProperties {
/**
* Enable template caching.
*/
private boolean cache;
/**
* Content-Type value.
*/
private String contentType = "text/html";
/**
* Template encoding.
*/
private String charset = "UTF-8";
/**
* White list of view names that can be resolved.
*/
private String[] viewNames;
/**
* Check that the templates location exists.
*/
private boolean checkTemplateLocation = true;
public void setCheckTemplateLocation(boolean checkTemplateLocation) {

View File

@ -31,22 +31,49 @@ public class ThymeleafProperties {
public static final String DEFAULT_SUFFIX = ".html";
/**
* Check that the templates location exists.
*/
private boolean checkTemplateLocation = true;
/**
* Prefix that gets prepended to view names when building a URL.
*/
private String prefix = DEFAULT_PREFIX;
/**
* Suffix that gets appended to view names when building a URL.
*/
private String suffix = DEFAULT_SUFFIX;
/**
* Template mode to be applied to templates. See also StandardTemplateModeHandlers.
*/
private String mode = "HTML5";
/**
* Template encoding.
*/
private String encoding = "UTF-8";
/**
* Content-Type value.
*/
private String contentType = "text/html";
/**
* Enable template caching.
*/
private boolean cache = true;
/**
* Comma-separated list of view names that can be resolved.
*/
private String[] viewNames;
/**
* Comma-separated list of view names that should be excluded from resolution.
*/
private String[] excludedViewNames;
public boolean isCheckTemplateLocation() {

View File

@ -38,16 +38,37 @@ public class VelocityProperties extends AbstractTemplateViewResolverProperties {
public static final String DEFAULT_SUFFIX = ".vm";
/**
* Name of the DateTool helper object to expose in the Velocity context of the view.
*/
private String dateToolAttribute;
/**
* Name of the NumberTool helper object to expose in the Velocity context of the view.
*/
private String numberToolAttribute;
/**
* Additional velocity properties.
*/
private Map<String, String> properties = new HashMap<String, String>();
/**
* Template path.
*/
private String resourceLoaderPath = DEFAULT_RESOURCE_LOADER_PATH;
/**
* Velocity Toolbox config location, for example "/WEB-INF/toolbox.xml". Automatically
* loads a Velocity Tools toolbox definition file and expose all defined tools in the
* specified scopes.
*/
private String toolboxConfigLocation;
/**
* Prefer file system access for template loading. File system access enables hot
* detection of template changes.
*/
private boolean preferFileSystemAccess = true;
public VelocityProperties() {

View File

@ -32,13 +32,13 @@ public class HttpEncodingProperties {
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
/**
* The Charset to use.
* Charset of HTTP requests and responses. Added to the "Content-Type" header if not
* set explicitly.
*/
private Charset charset = DEFAULT_CHARSET;
/**
* To force the encoding to the configured charset typically on HTTP requests and
* responses.
* Force the encoding to the configured charset on HTTP requests and responses.
*/
private boolean force = true;

View File

@ -38,8 +38,14 @@ public class HttpMapperProperties {
private final Log logger = LogFactory.getLog(HttpMapperProperties.class);
/**
* Enable json pretty print.
*/
private Boolean jsonPrettyPrint;
/**
* Enable key sorting.
*/
private Boolean jsonSortKeys;
public void setJsonPrettyPrint(Boolean jsonPrettyPrint) {

View File

@ -50,12 +50,27 @@ import org.springframework.util.StringUtils;
@ConfigurationProperties(prefix = "multipart", ignoreUnknownFields = false)
public class MultipartProperties {
/**
* Intermediate location of uploaded files.
*/
private String location;
/**
* Max file size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte
* or Kilobyte size.
*/
private String maxFileSize = "1Mb";
/**
* Max request size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte
* or Kilobyte size.
*/
private String maxRequestSize = "10Mb";
/**
* Threshold after which files will be written to disk. Values can use the suffixed "MB"
* or "KB" to indicate a Megabyte or Kilobyte size.
*/
private String fileSizeThreshold = "0";
public String getMaxFileSize() {

View File

@ -27,8 +27,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "spring.resources", ignoreUnknownFields = false)
public class ResourceProperties {
/**
* Cache period for the resources served by the resource handler, in seconds.
*/
private Integer cachePeriod;
/**
* Enable default resource handling.
*/
private boolean addMappings = true;
public Integer getCachePeriod() {

View File

@ -58,17 +58,32 @@ import org.springframework.util.StringUtils;
@ConfigurationProperties(prefix = "server", ignoreUnknownFields = false)
public class ServerProperties implements EmbeddedServletContainerCustomizer {
/**
* Server HTTP port.
*/
private Integer port;
/**
* Network address to which the server should bind to.
*/
private InetAddress address;
/**
* Session timeout in seconds.
*/
private Integer sessionTimeout;
/**
* Context path of the application.
*/
private String contextPath;
@NestedConfigurationProperty
private Ssl ssl;
/**
* Path of the main dispatcher servlet.
*/
@NotNull
private String servletPath = "/";
@ -76,6 +91,9 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
private final Undertow undertow = new Undertow();
/**
* ServletContext parameters.
*/
private final Map<String, String> contextParameters = new HashMap<String, String>();
public Tomcat getTomcat() {
@ -223,29 +241,64 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
public static class Tomcat {
/**
* Format pattern for access logs.
*/
private String accessLogPattern;
/**
* Enable access log.
*/
private boolean accessLogEnabled = false;
/**
* Regular expression that matches proxies that are to be trusted.
*/
private String internalProxies = "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 10/8
+ "192\\.168\\.\\d{1,3}\\.\\d{1,3}|" // 192.168/16
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"; // 127/8
/**
* Header that holds the incoming protocol, usually named "X-Forwarded-Proto". Configured
* as a RemoteIpValve only if remoteIpHeader is also set.
*/
private String protocolHeader;
/**
* Name of the HTTP header used to override the original port value.
*/
private String portHeader;
/**
* Name of the http header from which the remote ip is extracted. Configured as a
* RemoteIpValve only if remoteIpHeader is also set.
*/
private String remoteIpHeader;
/**
* Tomcat base directory. If not specified a temporary directory will be used.
*/
private File basedir;
/**
* Delay in seconds between the invocation of backgroundProcess methods.
*/
private int backgroundProcessorDelay = 30; // seconds
/**
* Maximum amount of worker threads.
*/
private int maxThreads = 0; // Number of threads in protocol handler
/**
* Maximum size in bytes of the HTTP message header.
*/
private int maxHttpHeaderSize = 0; // bytes
/**
* Character encoding to use to decode the URI.
*/
private String uriEncoding;
public int getMaxThreads() {
@ -409,12 +462,24 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
public static class Undertow {
/**
* Size of each buffer in bytes.
*/
private Integer bufferSize;
/**
* Number of buffer per region.
*/
private Integer buffersPerRegion;
/**
* Number of I/O threads to create for the worker.
*/
private Integer ioThreads;
/**
* Number of worker threads.
*/
private Integer workerThreads;
private Boolean directBuffers;

View File

@ -28,10 +28,19 @@ import org.springframework.validation.DefaultMessageCodesResolver;
@ConfigurationProperties("spring.mvc")
public class WebMvcProperties {
/**
* Formatting strategy for message codes (PREFIX_ERROR_CODE, POSTFIX_ERROR_CODE).
*/
private DefaultMessageCodesResolver.Format messageCodesResolverFormat;
/**
* Locale to use.
*/
private String locale;
/**
* Date format to use (e.g. dd/MM/yyyy)
*/
private String dateFormat;
public DefaultMessageCodesResolver.Format getMessageCodesResolverFormat() {

View File

@ -2,7 +2,7 @@
{
"name": "spring.aop.auto",
"type": "java.lang.Boolean",
"description": "Automatically adds @EnableAspectJAutoProxy.",
"description": "Add @EnableAspectJAutoProxy.",
"defaultValue": true
},
{
@ -20,37 +20,37 @@
{
"name": "spring.dao.exceptiontranslation.enabled",
"type": "java.lang.Boolean",
"description": "Enables the PersistenceExceptionTranslationPostProcessor.",
"description": "Enable the PersistenceExceptionTranslationPostProcessor.",
"defaultValue": true
},
{
"name": "spring.datasource.jmx-enabled",
"type": "java.lang.Boolean",
"description": "Enables JMX support (if provided by the underlying pool).",
"description": "Enable JMX support (if provided by the underlying pool).",
"defaultValue": false
},
{
"name": "spring.data.elasticsearch.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Automatically enable Elasticsearch repositories.",
"description": "Enable Elasticsearch repositories.",
"defaultValue": true
},
{
"name": "spring.data.jpa.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Automatically enable JPA repositories.",
"description": "Enable JPA repositories.",
"defaultValue": true
},
{
"name": "spring.data.mongodb.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Automatically enable Mongo repositories.",
"description": "Enable Mongo repositories.",
"defaultValue": true
},
{
"name": "spring.data.solr.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Automatically enable Solr repositories.",
"description": "Enable Solr repositories.",
"defaultValue": true
},
{
@ -62,13 +62,13 @@
{
"name": "spring.jmx.enabled",
"type": "java.lang.Boolean",
"description": "Automatically expose management beans to the JMX domain",
"description": "Expose management beans to the JMX domain.",
"defaultValue": true
},
{
"name": "spring.jpa.open-in-view",
"type": "java.lang.Boolean",
"description": "Automatically register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.",
"description": "Register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.",
"defaultValue": true
},
{
@ -92,7 +92,7 @@
{
"name": "spring.social.auto-connection-views",
"type": "java.lang.Boolean",
"description": "Automatically enable the connection status view for supported providers.",
"description": "Enable the connection status view for supported providers.",
"defaultValue": false
},
{

View File

@ -25,6 +25,9 @@ package org.springframework.boot.context.embedded;
*/
public class Ssl {
/**
* Client authentication mode ("want", "need").
*/
private ClientAuth clientAuth;
private String[] ciphers;
@ -33,8 +36,14 @@ public class Ssl {
private String keyPassword;
/**
* Path to the key store (typically a jks file).
*/
private String keyStore;
/**
* Login password of the key store.
*/
private String keyStorePassword;
private String keyStoreType;
@ -49,6 +58,9 @@ public class Ssl {
private String trustStoreProvider;
/**
* SSL protocol to use.
*/
private String protocol = "TLS";
public ClientAuth getClientAuth() {

View File

@ -13,13 +13,13 @@
{
"name": "logging.file",
"type": "java.lang.String",
"description": "The name of the log file.",
"description": "Log file name.",
"sourceType": "org.springframework.boot.logging.LoggingApplicationListener"
},
{
"name": "logging.level",
"type": "java.util.Map<java.lang.String,java.lang.Object>",
"description": "The log levels. Use 'root' for the root logger.",
"description": "Log levels severity mapping. Use 'root' for the root logger.",
"sourceType": "org.springframework.boot.logging.LoggingApplicationListener"
},
{
@ -32,38 +32,38 @@
"name": "spring.mandatory-file-encoding",
"sourceType": "org.springframework.boot.context.FileEncodingApplicationListener",
"type": "java.lang.String",
"description": "The character encoding the application must use."
"description": "Expected character encoding the application must use."
},
{
"name": "spring.application.name",
"type": "java.lang.String",
"sourceType": "org.springframework.boot.context.ContextIdApplicationContextInitializer",
"description": "The name of the application."
"description": "Application name."
},
{
"name": "spring.application.index",
"type": "java.lang.Integer",
"sourceType": "org.springframework.boot.context.ContextIdApplicationContextInitializer",
"description": "Index of the application."
"description": "Application index."
},
{
"name": "spring.config.name",
"type": "java.lang.String",
"sourceType": "org.springframework.boot.context.config.ConfigFileApplicationListener",
"description": "Config file name",
"description": "Config file name.",
"defaultValue": "application"
},
{
"name": "spring.config.location",
"type": "java.lang.String",
"sourceType": "org.springframework.boot.context.config.ConfigFileApplicationListener",
"description": "Config file locations"
"description": "Config file locations."
},
{
"name": "spring.main.show-banner",
"type": "java.lang.Boolean",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Display the banner when the application runs",
"description": "Display the banner when the application runs.",
"defaultValue": true
},
{
@ -76,12 +76,12 @@
"name": "spring.main.web-environment",
"type": "java.lang.Boolean",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Run the application in a web environment (auto-detected by default)"
"description": "Run the application in a web environment (auto-detected by default)."
},
{
"name": "spring.profiles.active",
"type": "java.lang.String",
"description": "Set the active profiles as a comma separated list. Can be overridden by a command line switch."
"description": "Comma-separated list of active profiles. Can be overridden by a command line switch."
},
{
"name": "spring.profiles.include",