Polishing
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -128,10 +128,12 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
||||
|
||||
private DateFormat dateFormat;
|
||||
|
||||
private JsonInclude.Include serializationInclusion;
|
||||
|
||||
private AnnotationIntrospector annotationIntrospector;
|
||||
|
||||
private PropertyNamingStrategy propertyNamingStrategy;
|
||||
|
||||
private JsonInclude.Include serializationInclusion;
|
||||
|
||||
private final Map<Class<?>, JsonSerializer<?>> serializers = new LinkedHashMap<Class<?>, JsonSerializer<?>>();
|
||||
|
||||
private final Map<Class<?>, JsonDeserializer<?>> deserializers = new LinkedHashMap<Class<?>, JsonDeserializer<?>>();
|
||||
@@ -144,8 +146,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
||||
|
||||
private boolean findModulesViaServiceLoader;
|
||||
|
||||
private PropertyNamingStrategy propertyNamingStrategy;
|
||||
|
||||
private ClassLoader beanClassLoader;
|
||||
|
||||
|
||||
@@ -184,6 +184,15 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
||||
this.annotationIntrospector = annotationIntrospector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a {@link com.fasterxml.jackson.databind.PropertyNamingStrategy} to
|
||||
* configure the {@link ObjectMapper} with.
|
||||
* @since 4.0.2
|
||||
*/
|
||||
public void setPropertyNamingStrategy(PropertyNamingStrategy propertyNamingStrategy) {
|
||||
this.propertyNamingStrategy = propertyNamingStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a custom inclusion strategy for serialization.
|
||||
* @see com.fasterxml.jackson.annotation.JsonInclude.Include
|
||||
@@ -331,15 +340,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
||||
this.findModulesViaServiceLoader = findModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a {@link com.fasterxml.jackson.databind.PropertyNamingStrategy} to
|
||||
* configure the {@link ObjectMapper} with.
|
||||
* @since 4.0.2
|
||||
*/
|
||||
public void setPropertyNamingStrategy(PropertyNamingStrategy propertyNamingStrategy) {
|
||||
this.propertyNamingStrategy = propertyNamingStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
|
||||
@@ -249,8 +249,8 @@ public final class WebAsyncManager {
|
||||
* @see #getConcurrentResult()
|
||||
* @see #getConcurrentResultContext()
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes" })
|
||||
public void startCallableProcessing(final Callable<?> callable, Object... processingContext) throws Exception {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public void startCallableProcessing(Callable<?> callable, Object... processingContext) throws Exception {
|
||||
Assert.notNull(callable, "Callable must not be null");
|
||||
startCallableProcessing(new WebAsyncTask(callable), processingContext);
|
||||
}
|
||||
|
||||
@@ -23,11 +23,6 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
@@ -50,6 +45,10 @@ import com.fasterxml.jackson.databind.ser.Serializers;
|
||||
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
|
||||
import com.fasterxml.jackson.databind.ser.std.NumberSerializers.NumberSerializer;
|
||||
import com.fasterxml.jackson.databind.type.SimpleType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -65,11 +64,13 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
|
||||
private Jackson2ObjectMapperFactoryBean factory;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
factory = new Jackson2ObjectMapperFactoryBean();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSettersWithNullValues() {
|
||||
// Should not crash:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -16,18 +16,18 @@
|
||||
|
||||
package org.springframework.web.socket.config.annotation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.messaging.converter.MessageConverter;
|
||||
import org.springframework.messaging.simp.config.ChannelRegistration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Defines methods for configuring message handling with simple messaging
|
||||
* protocols (e.g. STOMP) from WebSocket clients. Typically used to customize
|
||||
* the configuration provided via
|
||||
* {@link org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
|
||||
* protocols (e.g. STOMP) from WebSocket clients.
|
||||
*
|
||||
* <p>Typically used to customize the configuration provided via
|
||||
* {@link EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
@@ -56,7 +56,7 @@ public interface WebSocketMessageBrokerConfigurer {
|
||||
|
||||
/**
|
||||
* Configure the {@link org.springframework.messaging.MessageChannel} used for
|
||||
* incoming messages from WebSocket clients. By default the channel is backed
|
||||
* outbound messages to WebSocket clients. By default the channel is backed
|
||||
* by a thread pool of size 1. It is recommended to customize thread pool
|
||||
* settings for production use.
|
||||
*/
|
||||
@@ -66,12 +66,10 @@ public interface WebSocketMessageBrokerConfigurer {
|
||||
* Configure the message converters to use when extracting the payload of
|
||||
* messages in annotated methods and when sending messages (e.g. through the
|
||||
* "broker" SimpMessagingTemplate).
|
||||
* <p>
|
||||
* The provided list, initially empty, can be used to add message converters
|
||||
* <p>The provided list, initially empty, can be used to add message converters
|
||||
* while the boolean return value is used to determine if default message should
|
||||
* be added as well.
|
||||
*
|
||||
* @param messageConverters initially an empty list of converters
|
||||
* @param messageConverters the converters to configure (initially an empty list)
|
||||
* @return whether to also add default converter or not
|
||||
*/
|
||||
boolean configureMessageConverters(List<MessageConverter> messageConverters);
|
||||
|
||||
Reference in New Issue
Block a user