From 43c07e8b4415ed9c365ba39881c3b265edb23203 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 3 Nov 2014 17:43:53 -0800 Subject: [PATCH] Protect against duplicate datasource MBeans See gh-1590 --- .../boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index 219bba6af2..6bf2d7b67d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -148,6 +148,7 @@ public class DataSourceAutoConfiguration { @ConditionalOnProperty(prefix = "spring.datasource", name = "jmx-enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnClass(name = "org.apache.tomcat.jdbc.pool.DataSourceProxy") @Conditional(DataSourceAutoConfiguration.DataSourceAvailableCondition.class) + @ConditionalOnMissingBean(name = "dataSourceMBean") protected static class TomcatDataSourceJmxConfiguration { @Bean