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:
@@ -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")
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user