|
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.beans.factory.ObjectProvider;
|
28 | 27 | import org.springframework.boot.autoconfigure.AutoConfiguration;
|
29 | 28 | import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
|
44 | 43 | import org.springframework.boot.context.properties.PropertyMapper;
|
45 | 44 | import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
|
46 | 45 | import org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder;
|
| 46 | +import org.springframework.context.ApplicationContext; |
47 | 47 | import org.springframework.context.annotation.Bean;
|
48 | 48 | import org.springframework.context.annotation.Conditional;
|
49 | 49 | import org.springframework.context.annotation.Configuration;
|
@@ -200,14 +200,21 @@ public ThreadPoolTaskScheduler taskScheduler(
|
200 | 200 | protected static class IntegrationJmxConfiguration {
|
201 | 201 |
|
202 | 202 | @Bean
|
203 |
| - public IntegrationMBeanExporter integrationMbeanExporter(BeanFactory beanFactory, JmxProperties properties) { |
204 |
| - IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); |
205 |
| - String defaultDomain = properties.getDefaultDomain(); |
206 |
| - if (StringUtils.hasLength(defaultDomain)) { |
207 |
| - exporter.setDefaultDomain(defaultDomain); |
208 |
| - } |
209 |
| - exporter.setServer(beanFactory.getBean(properties.getServer(), MBeanServer.class)); |
210 |
| - return exporter; |
| 203 | + public static IntegrationMBeanExporter integrationMbeanExporter(ApplicationContext applicationContext) { |
| 204 | + return new IntegrationMBeanExporter() { |
| 205 | + |
| 206 | + @Override |
| 207 | + public void afterSingletonsInstantiated() { |
| 208 | + JmxProperties properties = applicationContext.getBean(JmxProperties.class); |
| 209 | + String defaultDomain = properties.getDefaultDomain(); |
| 210 | + if (StringUtils.hasLength(defaultDomain)) { |
| 211 | + setDefaultDomain(defaultDomain); |
| 212 | + } |
| 213 | + setServer(applicationContext.getBean(properties.getServer(), MBeanServer.class)); |
| 214 | + super.afterSingletonsInstantiated(); |
| 215 | + } |
| 216 | + |
| 217 | + }; |
211 | 218 | }
|
212 | 219 |
|
213 | 220 | }
|
|
0 commit comments