Skip to content

Commit

Permalink
Generate standard configuration meta-data
Browse files Browse the repository at this point in the history
Update the `spring-boot`, `spring-boot-autoconfigure` and
`spring-boot-actuator` project to generate configuration meta-data
files during compilation.

See spring-projectsgh-1001
  • Loading branch information
snicoll authored and philwebb committed Nov 3, 2014
1 parent c73adcd commit fbf8f56
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spring-boot-actuator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
<artifactId>commons-dbcp</artifactId>
<optional>true</optional>
</dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"properties": [
{
"name": "spring.git.properties",
"dataType": "java.lang.String",
"description": "Resource reference to a generated git info properties file."
}
]}

6 changes: 6 additions & 0 deletions spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@
<artifactId>aspectjweaver</artifactId>
<optional>true</optional>
</dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void afterPropertiesSet() throws Exception {
.get(this.classLoader);
}

protected String getDriverClassName() {
public String getDriverClassName() {
if (StringUtils.hasText(this.driverClassName)) {
Assert.state(ClassUtils.isPresent(this.driverClassName, null),
"Cannot load driver class: " + this.driverClassName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,5 @@ public void customize(Connector connector) {
}

}

}
Original file line number Diff line number Diff line change
@@ -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.",
}
]}

6 changes: 6 additions & 0 deletions spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@
<artifactId>snakeyaml</artifactId>
<optional>true</optional>
</dependency>
<!-- Annotation processing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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)"
}
]}

0 comments on commit fbf8f56

Please sign in to comment.