Flag main MbeanExporter `@Primary`
When the actuator is enabled, Spring Boot provides two `MBeanExporter` bean definitions: a general purpose one and a dedicated one for Actuator endpoints. This commit flag the general purpose one `@Primary` so that component can safely inject it by type if necessary. In particular, this fix the doc of the `JmxMetricWriter`. Closes gh-4007
This commit is contained in:
parent
6c4e4520d4
commit
00af1f5c10
|
@ -32,6 +32,7 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableMBeanExport;
|
||||
import org.springframework.context.annotation.MBeanExportConfiguration.SpecificPlatform;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.jmx.export.MBeanExporter;
|
||||
import org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource;
|
||||
|
@ -69,6 +70,7 @@ public class JmxAutoConfiguration implements EnvironmentAware, BeanFactoryAware
|
|||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnMissingBean(value = MBeanExporter.class, search = SearchStrategy.CURRENT)
|
||||
public AnnotationMBeanExporter mbeanExporter(ObjectNamingStrategy namingStrategy) {
|
||||
AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();
|
||||
|
|
Loading…
Reference in New Issue