Default spring.datasource.jmx-enabled to false

Change the default value of spring.datasource.jmx-enabled to false
to prevent InstanceAlreadyExistsException problems when using the
Spring Test Framework.

Fixes gh-1590
This commit is contained in:
Phillip Webb
2014-11-06 20:55:04 -08:00
parent d040bb72d3
commit 96a031cf20
6 changed files with 8 additions and 4 deletions

View File

@@ -145,7 +145,7 @@ public class DataSourceAutoConfiguration {
}
@Configuration
@ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled")
@ConditionalOnClass(name = "org.apache.tomcat.jdbc.pool.DataSourceProxy")
@Conditional(DataSourceAutoConfiguration.DataSourceAvailableCondition.class)
@ConditionalOnMissingBean(name = "dataSourceMBean")

View File

@@ -27,7 +27,7 @@
"name": "spring.datasource.jmx-enabled",
"dataType": "java.lang.Boolean",
"description": "Enables JMX support (if provided by the underlying pool).",
"defaultValue": true
"defaultValue": false
},
{
"name": "spring.data.elasticsearch.repositories.enabled",

View File

@@ -32,6 +32,7 @@ import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.context.annotation.Import;
import org.springframework.util.ReflectionUtils;
@@ -133,6 +134,7 @@ public class TomcatDataSourceConfigurationTests {
@Configuration
@Import(DataSourceAutoConfiguration.class)
@EnableMBeanExport
protected static class TomcatDataSourceConfiguration {
@Autowired