|
23 | 23 |
|
24 | 24 | import io.rsocket.transport.netty.server.TcpServerTransport;
|
25 | 25 |
|
26 |
| -import org.springframework.beans.factory.BeanFactory; |
27 | 26 | import org.springframework.beans.factory.ObjectProvider;
|
28 | 27 | import org.springframework.boot.autoconfigure.AutoConfiguration;
|
29 | 28 | import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
|
48 | 47 | import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
|
49 | 48 | import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
|
50 | 49 | import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
|
| 50 | +import org.springframework.context.ApplicationContext; |
51 | 51 | import org.springframework.context.annotation.Bean;
|
52 | 52 | import org.springframework.context.annotation.Conditional;
|
53 | 53 | import org.springframework.context.annotation.Configuration;
|
@@ -213,14 +213,21 @@ public SimpleAsyncTaskScheduler taskSchedulerVirtualThreads(
|
213 | 213 | protected static class IntegrationJmxConfiguration {
|
214 | 214 |
|
215 | 215 | @Bean
|
216 |
| - public IntegrationMBeanExporter integrationMbeanExporter(BeanFactory beanFactory, JmxProperties properties) { |
217 |
| - IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); |
218 |
| - String defaultDomain = properties.getDefaultDomain(); |
219 |
| - if (StringUtils.hasLength(defaultDomain)) { |
220 |
| - exporter.setDefaultDomain(defaultDomain); |
221 |
| - } |
222 |
| - exporter.setServer(beanFactory.getBean(properties.getServer(), MBeanServer.class)); |
223 |
| - return exporter; |
| 216 | + public static IntegrationMBeanExporter integrationMbeanExporter(ApplicationContext applicationContext) { |
| 217 | + return new IntegrationMBeanExporter() { |
| 218 | + |
| 219 | + @Override |
| 220 | + public void afterSingletonsInstantiated() { |
| 221 | + JmxProperties properties = applicationContext.getBean(JmxProperties.class); |
| 222 | + String defaultDomain = properties.getDefaultDomain(); |
| 223 | + if (StringUtils.hasLength(defaultDomain)) { |
| 224 | + setDefaultDomain(defaultDomain); |
| 225 | + } |
| 226 | + setServer(applicationContext.getBean(properties.getServer(), MBeanServer.class)); |
| 227 | + super.afterSingletonsInstantiated(); |
| 228 | + } |
| 229 | + |
| 230 | + }; |
224 | 231 | }
|
225 | 232 |
|
226 | 233 | }
|
|
0 commit comments