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
This commit is contained in:
Stephane Nicoll
2014-10-28 15:04:52 -07:00
committed by Phillip Webb
parent c73adcd198
commit fbf8f56a97
9 changed files with 235 additions and 1 deletions

View File

@@ -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();
}
}

View File

@@ -80,7 +80,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
.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);

View File

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

View File

@@ -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.",
}
]}