This commit is contained in:
Phillip Webb
2014-11-03 17:20:40 -08:00
parent 9b6cb83be5
commit a973fd41f4
17 changed files with 192 additions and 123 deletions

View File

@@ -35,7 +35,6 @@ public enum SearchStrategy {
/**
* Search the entire hierarchy
*
*/
ALL;

View File

@@ -32,8 +32,8 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerPostProcessor.Registrar;
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration;
@@ -65,7 +65,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
@EnableConfigurationProperties(DataSourceProperties.class)
@Import({ Registrar.class, DataSourcePoolMetadataProvidersConfiguration.class })
public class DataSourceAutoConfiguration {
private static Log logger = LogFactory.getLog(DataSourceAutoConfiguration.class);
/**
@@ -145,22 +145,24 @@ public class DataSourceAutoConfiguration {
}
@Configuration
@ConditionalOnExpression("${spring.datasource.jmxEnabled:true}")
@ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnClass(name = "org.apache.tomcat.jdbc.pool.DataSourceProxy")
@Conditional(DataSourceAutoConfiguration.DataSourceAvailableCondition.class)
protected static class TomcatDataSourceJmxConfiguration {
@Bean
public Object dataSourceMBean(DataSource dataSource) {
if (dataSource instanceof DataSourceProxy) {
try {
return ((DataSourceProxy) dataSource).createPool().getJmxPool();
}
catch (SQLException e) {
catch (SQLException ex) {
logger.warn("Cannot expose DataSource to JMX (could not connect)");
}
}
return null;
}
}
/**

View File

@@ -17,6 +17,12 @@
"description": "Execute all Spring Batch jobs in the context on startup.",
"defaultValue": true,
},
{
"name": "spring.datasource.jmx-enabled",
"dataType": "java.lang.Boolean",
"description": "Enables JMX support (if provided by the underlying pool).",
"defaultValue": true,
},
{
"name": "spring.data.elasticsearch.repositories.enabled",
"dataType": "java.lang.Boolean",