Skip to content

Commit 0dca16c

Browse files
committed
Merge branch '3.3.x' into 3.4.x
Closes gh-45194
2 parents b80bdbb + 9b1b7e6 commit 0dca16c

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323

2424
import io.rsocket.transport.netty.server.TcpServerTransport;
2525

26-
import org.springframework.beans.factory.BeanFactory;
2726
import org.springframework.boot.autoconfigure.AutoConfiguration;
2827
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
2928
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
@@ -46,6 +45,7 @@
4645
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
4746
import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
4847
import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
48+
import org.springframework.context.ApplicationContext;
4949
import org.springframework.context.annotation.Bean;
5050
import org.springframework.context.annotation.Conditional;
5151
import org.springframework.context.annotation.Configuration;
@@ -208,14 +208,21 @@ public SimpleAsyncTaskScheduler taskSchedulerVirtualThreads(
208208
protected static class IntegrationJmxConfiguration {
209209

210210
@Bean
211-
public IntegrationMBeanExporter integrationMbeanExporter(BeanFactory beanFactory, JmxProperties properties) {
212-
IntegrationMBeanExporter exporter = new IntegrationMBeanExporter();
213-
String defaultDomain = properties.getDefaultDomain();
214-
if (StringUtils.hasLength(defaultDomain)) {
215-
exporter.setDefaultDomain(defaultDomain);
216-
}
217-
exporter.setServer(beanFactory.getBean(properties.getServer(), MBeanServer.class));
218-
return exporter;
211+
public static IntegrationMBeanExporter integrationMbeanExporter(ApplicationContext applicationContext) {
212+
return new IntegrationMBeanExporter() {
213+
214+
@Override
215+
public void afterSingletonsInstantiated() {
216+
JmxProperties properties = applicationContext.getBean(JmxProperties.class);
217+
String defaultDomain = properties.getDefaultDomain();
218+
if (StringUtils.hasLength(defaultDomain)) {
219+
setDefaultDomain(defaultDomain);
220+
}
221+
setServer(applicationContext.getBean(properties.getServer(), MBeanServer.class));
222+
super.afterSingletonsInstantiated();
223+
}
224+
225+
};
219226
}
220227

221228
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void enableJmxIntegration() {
149149
this.contextRunner.withPropertyValues("spring.jmx.enabled=true").run((context) -> {
150150
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
151151
assertThat(mBeanServer.getDomains()).contains("org.springframework.integration",
152-
"org.springframework.integration.monitor");
152+
"org.springframework.boot.autoconfigure.integration");
153153
assertThat(context).hasBean(IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME);
154154
});
155155
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-integration/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies {
99

1010
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-integration"))
1111
implementation("org.springframework.integration:spring-integration-file")
12+
implementation("org.springframework.integration:spring-integration-jmx")
1213

1314
testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
1415
testImplementation("org.awaitility:awaitility")

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-integration/src/main/resources/application.properties

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ logging.level.org.springframework.integration.file=DEBUG
22
service.greeting=Hello
33
service.input-dir=input
44
service.output-dir=output
5+
spring.jmx.enabled=true

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-integration/src/test/java/smoketest/integration/consumer/SampleIntegrationApplicationTests.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,18 +25,22 @@
2525
import org.awaitility.Awaitility;
2626
import org.junit.jupiter.api.AfterEach;
2727
import org.junit.jupiter.api.Test;
28+
import org.junit.jupiter.api.extension.ExtendWith;
2829
import org.junit.jupiter.api.io.TempDir;
2930
import smoketest.integration.SampleIntegrationApplication;
3031
import smoketest.integration.ServiceProperties;
3132
import smoketest.integration.producer.ProducerApplication;
3233

3334
import org.springframework.boot.SpringApplication;
35+
import org.springframework.boot.test.system.CapturedOutput;
36+
import org.springframework.boot.test.system.OutputCaptureExtension;
3437
import org.springframework.context.ConfigurableApplicationContext;
3538
import org.springframework.core.io.DefaultResourceLoader;
3639
import org.springframework.core.io.Resource;
3740
import org.springframework.core.io.support.ResourcePatternUtils;
3841
import org.springframework.util.StreamUtils;
3942

43+
import static org.assertj.core.api.Assertions.assertThat;
4044
import static org.hamcrest.Matchers.containsString;
4145

4246
/**
@@ -45,12 +49,14 @@
4549
* @author Dave Syer
4650
* @author Andy Wilkinson
4751
*/
52+
@ExtendWith(OutputCaptureExtension.class)
4853
class SampleIntegrationApplicationTests {
4954

5055
private ConfigurableApplicationContext context;
5156

5257
@AfterEach
53-
void stop() {
58+
void stopAndCheck(CapturedOutput output) {
59+
assertThat(output).doesNotContain("WARN");
5460
if (this.context != null) {
5561
this.context.close();
5662
}

0 commit comments

Comments
 (0)