|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2024 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
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.boot.autoconfigure.AutoConfiguration;
|
28 | 27 | import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
29 | 28 | import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
|
46 | 45 | import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
|
47 | 46 | import org.springframework.boot.task.SimpleAsyncTaskSchedulerBuilder;
|
48 | 47 | import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
|
| 48 | +import org.springframework.context.ApplicationContext; |
49 | 49 | import org.springframework.context.annotation.Bean;
|
50 | 50 | import org.springframework.context.annotation.Conditional;
|
51 | 51 | import org.springframework.context.annotation.Configuration;
|
@@ -208,14 +208,21 @@ public SimpleAsyncTaskScheduler taskSchedulerVirtualThreads(
|
208 | 208 | protected static class IntegrationJmxConfiguration {
|
209 | 209 |
|
210 | 210 | @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 | + }; |
219 | 226 | }
|
220 | 227 |
|
221 | 228 | }
|
|
0 commit comments