Generate standard configuration meta-data

Update the `spring-boot`, `spring-boot-autoconfigure` and
`spring-boot-actuator` project to generate configuration meta-data
files during compilation.

See gh-1001
pull/1815/head
Stephane Nicoll 10 years ago committed by Phillip Webb
parent c73adcd198
commit fbf8f56a97

@ -151,6 +151,12 @@
<artifactId>commons-dbcp</artifactId> <artifactId>commons-dbcp</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test --> <!-- Test -->
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>

@ -0,0 +1,8 @@
{"properties": [
{
"name": "spring.git.properties",
"dataType": "java.lang.String",
"description": "Resource reference to a generated git info properties file."
}
]}

@ -390,6 +390,12 @@
<artifactId>aspectjweaver</artifactId> <artifactId>aspectjweaver</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test --> <!-- Test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

@ -0,0 +1,49 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jdbc;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Expose the metadata of the supported data sources. Only used to harvest
* the relevant properties metadata.
*
* @author Stephane Nicoll
* @since 1.2.0
*/
class DataSourceConfigMetadata {
@ConfigurationProperties(DataSourceProperties.PREFIX)
public DataSource tomcatDataSource() {
return (DataSource) DataSourceBuilder.create().type(DataSource.class).build();
}
@ConfigurationProperties(DataSourceProperties.PREFIX)
public HikariDataSource hikariDataSource() {
return (HikariDataSource) DataSourceBuilder.create().type(HikariDataSource.class).build();
}
@ConfigurationProperties(DataSourceProperties.PREFIX)
public BasicDataSource dbcpDataSource() {
return (BasicDataSource)DataSourceBuilder.create().type(BasicDataSource.class).build();
}
}

@ -80,7 +80,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
.get(this.classLoader); .get(this.classLoader);
} }
protected String getDriverClassName() { public String getDriverClassName() {
if (StringUtils.hasText(this.driverClassName)) { if (StringUtils.hasText(this.driverClassName)) {
Assert.state(ClassUtils.isPresent(this.driverClassName, null), Assert.state(ClassUtils.isPresent(this.driverClassName, null),
"Cannot load driver class: " + this.driverClassName); "Cannot load driver class: " + this.driverClassName);

@ -381,4 +381,5 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
} }
} }
} }

@ -0,0 +1,85 @@
{"properties": [
{
"name": "spring.aop.auto",
"dataType": "java.lang.Boolean",
"description": "Automatically adds @EnableAspectJAutoProxy.",
"defaultValue": true,
},
{
"name": "spring.aop.proxy-target-class",
"dataType": "java.lang.Boolean",
"description": "Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false).",
"defaultValue": false,
},
{
"name": "spring.batch.enabled",
"dataType": "java.lang.Boolean",
"description": "Execute all Spring Batch jobs in the context on startup.",
"defaultValue": true,
},
{
"name": "spring.data.elasticsearch.repositories.enabled",
"dataType": "java.lang.Boolean",
"description": "Automatically enable Elasticsearch repositories.",
"defaultValue": true,
},
{
"name": "spring.data.jpa.repositories.enabled",
"dataType": "java.lang.Boolean",
"description": "Automatically enable JPA repositories.",
"defaultValue": true,
},
{
"name": "spring.data.mongo.repositories.enabled",
"dataType": "java.lang.Boolean",
"description": "Automatically enable Mongo repositories.",
"defaultValue": true,
},
{
"name": "spring.data.solr.repositories.enabled",
"dataType": "java.lang.Boolean",
"description": "Automatically enable Solr repositories.",
"defaultValue": true,
},
{
"name": "spring.jmx.enabled",
"dataType": "java.lang.Boolean",
"description": "Automatically expose management beans to the JMX domain",
"defaultValue": true,
},
{
"name": "spring.jpa.open-in-view",
"dataType": "java.lang.Boolean",
"description": "Automatically register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.",
"defaultValue": true,
},
{
"name": "spring.mobile.devicedelegatingviewresolver.enabled",
"dataType": "java.lang.Boolean",
"description": "Enable device view resolver.",
"defaultValue": false,
},
{
"name": "spring.mobile.sitepreference.enabled",
"dataType": "java.lang.Boolean",
"description": "Enable SitePreferenceHandler.",
"defaultValue": true,
},
{
"name": "spring.social.auto-connection-views",
"dataType": "java.lang.Boolean",
"description": "Automatically enable the connection status view for supported providers.",
"defaultValue": false,
},
{
"name": "spring.view.prefix",
"dataType": "java.lang.String",
"description": "Spring MVC view prefix.",
},
{
"name": "spring.view.suffix",
"dataType": "java.lang.String",
"description": "Spring MVC view suffix.",
}
]}

@ -169,6 +169,12 @@
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test --> <!-- Test -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>

@ -0,0 +1,73 @@
{"groups": [
{
"name": "logging",
"sourceType": "org.springframework.boot.logging.LoggingApplicationListener"
}
],"properties": [
{
"name": "logging.config",
"dataType": "java.lang.String",
"description": "Location of the logging configuration file."
},
{
"name": "logging.file",
"dataType": "java.lang.String",
"description": "The name of the log file."
},
{
"name": "logging.path",
"dataType": "java.lang.String",
"description": "Location of the log file."
},
{
"name": "spring.mandatory-file-encoding",
"sourceType": "org.springframework.boot.context.FileEncodingApplicationListener",
"dataType": "java.lang.String",
"description": "The character encoding the application must use."
},
{
"name": "spring.application.name",
"dataType": "java.lang.String",
"sourceType": "org.springframework.boot.context.ContextIdApplicationContextInitializer",
"description": "The name of the application."
},
{
"name": "spring.application.index",
"dataType": "java.lang.Integer",
"sourceType": "org.springframework.boot.context.ContextIdApplicationContextInitializer",
"description": "Index of the application."
},
{
"name": "spring.config.name",
"dataType": "java.lang.String",
"sourceType": "org.springframework.boot.context.config.ConfigFileApplicationListener",
"description": "Config file name",
"defaultValue": "application",
},
{
"name": "spring.config.location",
"dataType": "java.lang.String",
"sourceType": "org.springframework.boot.context.config.ConfigFileApplicationListener",
"description": "Config file locations",
},
{
"name": "spring.main.show-banner",
"dataType": "java.lang.Boolean",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Display the banner when the application runs",
"defaultValue": true,
},
{
"name": "spring.main.sources",
"dataType": "java.util.Set<java.lang.Object>",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Sources (class name, package name or XML resource location) used to create the ApplicationContext."
},
{
"name": "spring.main.web-environment",
"dataType": "java.lang.Boolean",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Run the application in a web environment (auto-detected by default)"
}
]}
Loading…
Cancel
Save