Polishing

This commit is contained in:
Juergen Hoeller
2014-10-01 01:10:25 +02:00
parent 44e29210cb
commit 3a3c52dbdd
6 changed files with 24 additions and 23 deletions

View File

@@ -32,7 +32,6 @@ import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.jmx.support.WebSphereMBeanServerFactoryBean;
import org.springframework.jndi.JndiLocatorDelegate;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@@ -63,8 +62,10 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName());
this.attributes = AnnotationAttributes.fromMap(map);
Assert.notNull(this.attributes,
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
if (this.attributes == null) {
throw new IllegalArgumentException(
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
}
}
@Override
@@ -78,7 +79,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
}
@Bean(name=MBEAN_EXPORTER_BEAN_NAME)
@Bean(name = MBEAN_EXPORTER_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationMBeanExporter mbeanExporter() {
AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();

View File

@@ -57,6 +57,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
private static final Set<ConfigurableApplicationContext> applicationContexts =
new LinkedHashSet<ConfigurableApplicationContext>();
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
if (mbeanDomain != null) {
@@ -94,6 +95,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
private ConfigurableApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
Assert.isTrue(applicationContext instanceof ConfigurableApplicationContext,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.springframework.jmx.support;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.management.MBeanServer;
import org.springframework.beans.factory.FactoryBean;
@@ -34,8 +33,9 @@ import org.springframework.jmx.MBeanServerNotFoundException;
* This FactoryBean is a direct alternative to {@link MBeanServerFactoryBean},
* which uses standard JMX 1.2 API to access the platform's MBeanServer.
*
* <p>See Javadoc for WebSphere's <a href="http://bit.ly/UzccDt">{@code
* AdminServiceFactory}</a> and <a href="http://bit.ly/TRlX2r">{@code MBeanFactory}</a>.
* <p>See the javadocs for WebSphere's
* <a href="http://bit.ly/UzccDt">{@code AdminServiceFactory}</a>
* and <a href="http://bit.ly/TRlX2r">{@code MBeanFactory}</a>.
*
* @author Juergen Hoeller
* @author Rob Harrop