From 52b9b8e711129a390e6707b5931af7899766c456 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 8 Jan 2025 15:44:35 -0800 Subject: [PATCH] Fix tests failing due to missing 'spring.jmx.enabled=true' See gh-43706 --- .../autoconfigure/jdbc/DataSourceJmxConfigurationTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJmxConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJmxConfigurationTests.java index b8c365a8f5..007b85c53d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJmxConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceJmxConfigurationTests.java @@ -149,7 +149,7 @@ class DataSourceJmxConfigurationTests { @Test void tomcatAutoConfiguredCanExposeMBeanPool() { this.contextRunner - .withPropertyValues("spring.datasource.type=" + DataSource.class.getName(), + .withPropertyValues("spring.jmx.enabled=true", "spring.datasource.type=" + DataSource.class.getName(), "spring.datasource.tomcat.jmx-enabled=true") .run((context) -> { assertThat(context).hasBean("dataSourceMBean"); @@ -162,7 +162,7 @@ class DataSourceJmxConfigurationTests { @Test void tomcatProxiedCanExposeMBeanPool() { this.contextRunner.withUserConfiguration(DataSourceProxyConfiguration.class) - .withPropertyValues("spring.datasource.type=" + DataSource.class.getName(), + .withPropertyValues("spring.jmx.enabled=true", "spring.datasource.type=" + DataSource.class.getName(), "spring.datasource.tomcat.jmx-enabled=true") .run((context) -> { assertThat(context).hasBean("dataSourceMBean"); @@ -173,7 +173,7 @@ class DataSourceJmxConfigurationTests { @Test void tomcatDelegateCanExposeMBeanPool() { this.contextRunner.withUserConfiguration(DataSourceDelegateConfiguration.class) - .withPropertyValues("spring.datasource.type=" + DataSource.class.getName(), + .withPropertyValues("spring.jmx.enabled=true", "spring.datasource.type=" + DataSource.class.getName(), "spring.datasource.tomcat.jmx-enabled=true") .run((context) -> { assertThat(context).hasBean("dataSourceMBean");