Polishing
This commit is contained in:
parent
c1a9e3484a
commit
2b3409461f
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,9 +28,9 @@ import org.springframework.context.annotation.Role;
|
||||||
* annotated with @{@link org.springframework.beans.factory.annotation.Configurable
|
* annotated with @{@link org.springframework.beans.factory.annotation.Configurable
|
||||||
* Configurable}.
|
* Configurable}.
|
||||||
*
|
*
|
||||||
* <p>This configuration class is automatically imported when using the @{@link
|
* <p>This configuration class is automatically imported when using the
|
||||||
* EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured} Javadoc for
|
* @{@link EnableSpringConfigured} annotation. See {@code @EnableSpringConfigured}'s
|
||||||
* complete usage details.
|
* javadoc for complete usage details.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
|
@ -42,9 +42,10 @@ public class SpringConfiguredConfiguration {
|
||||||
public static final String BEAN_CONFIGURER_ASPECT_BEAN_NAME =
|
public static final String BEAN_CONFIGURER_ASPECT_BEAN_NAME =
|
||||||
"org.springframework.context.config.internalBeanConfigurerAspect";
|
"org.springframework.context.config.internalBeanConfigurerAspect";
|
||||||
|
|
||||||
@Bean(name=BEAN_CONFIGURER_ASPECT_BEAN_NAME)
|
@Bean(name = BEAN_CONFIGURER_ASPECT_BEAN_NAME)
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public AnnotationBeanConfigurerAspect beanConfigurerAspect() {
|
public AnnotationBeanConfigurerAspect beanConfigurerAspect() {
|
||||||
return AnnotationBeanConfigurerAspect.aspectOf();
|
return AnnotationBeanConfigurerAspect.aspectOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -47,7 +47,7 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
|
||||||
|
|
||||||
private AnnotationAttributes enableLTW;
|
private AnnotationAttributes enableLTW;
|
||||||
|
|
||||||
@Autowired(required=false)
|
@Autowired(required = false)
|
||||||
private LoadTimeWeavingConfigurer ltwConfigurer;
|
private LoadTimeWeavingConfigurer ltwConfigurer;
|
||||||
|
|
||||||
private ClassLoader beanClassLoader;
|
private ClassLoader beanClassLoader;
|
||||||
|
|
@ -66,7 +66,7 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean(name=ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME)
|
@Bean(name = ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME)
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public LoadTimeWeaver loadTimeWeaver() {
|
public LoadTimeWeaver loadTimeWeaver() {
|
||||||
LoadTimeWeaver loadTimeWeaver = null;
|
LoadTimeWeaver loadTimeWeaver = null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -43,6 +43,7 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
|
||||||
protected AnnotationAttributes enableAsync;
|
protected AnnotationAttributes enableAsync;
|
||||||
|
|
||||||
protected Executor executor;
|
protected Executor executor;
|
||||||
|
|
||||||
protected AsyncUncaughtExceptionHandler exceptionHandler;
|
protected AsyncUncaughtExceptionHandler exceptionHandler;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,7 +58,7 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
|
||||||
/**
|
/**
|
||||||
* Collect any {@link AsyncConfigurer} beans through autowiring.
|
* Collect any {@link AsyncConfigurer} beans through autowiring.
|
||||||
*/
|
*/
|
||||||
@Autowired(required=false)
|
@Autowired(required = false)
|
||||||
void setConfigurers(Collection<AsyncConfigurer> configurers) {
|
void setConfigurers(Collection<AsyncConfigurer> configurers) {
|
||||||
if (CollectionUtils.isEmpty(configurers)) {
|
if (CollectionUtils.isEmpty(configurers)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -29,18 +29,6 @@ import org.springframework.core.io.support.EncodedResource;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ScriptStatementFailedException extends ScriptException {
|
public class ScriptStatementFailedException extends ScriptException {
|
||||||
|
|
||||||
/**
|
|
||||||
* Build an error message based on the supplied parameters.
|
|
||||||
* @param statement the actual SQL statement that failed
|
|
||||||
* @param statementNumber the statement number in the SQL script (i.e.,
|
|
||||||
* the nth statement present in the resource)
|
|
||||||
* @param encodedResource the resource from which the SQL statement was read
|
|
||||||
*/
|
|
||||||
public static String buildErrorMessage(String statement, int statementNumber, EncodedResource encodedResource) {
|
|
||||||
return String.format("Failed to execute SQL script statement #%s of %s: %s",
|
|
||||||
statementNumber, encodedResource, statement);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new {@code ScriptStatementFailedException}.
|
* Construct a new {@code ScriptStatementFailedException}.
|
||||||
* @param statement the actual SQL statement that failed
|
* @param statement the actual SQL statement that failed
|
||||||
|
|
@ -53,4 +41,16 @@ public class ScriptStatementFailedException extends ScriptException {
|
||||||
super(buildErrorMessage(statement, statementNumber, resource), cause);
|
super(buildErrorMessage(statement, statementNumber, resource), cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an error message based on the supplied parameters.
|
||||||
|
* @param statement the actual SQL statement that failed
|
||||||
|
* @param statementNumber the statement number in the SQL script (i.e.,
|
||||||
|
* the nth statement present in the resource)
|
||||||
|
* @param encodedResource the resource from which the SQL statement was read
|
||||||
|
*/
|
||||||
|
public static String buildErrorMessage(String statement, int statementNumber, EncodedResource encodedResource) {
|
||||||
|
return String.format("Failed to execute SQL script statement #%s of %s: %s",
|
||||||
|
statementNumber, encodedResource, statement);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -26,8 +26,8 @@ import org.springframework.transaction.interceptor.TransactionAttributeSource;
|
||||||
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code @Configuration} class that registers the Spring infrastructure beans necessary
|
* {@code @Configuration} class that registers the Spring infrastructure beans
|
||||||
* to enable proxy-based annotation-driven transaction management.
|
* necessary to enable proxy-based annotation-driven transaction management.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
|
@ -37,7 +37,7 @@ import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
|
public class ProxyTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration {
|
||||||
|
|
||||||
@Bean(name=TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
|
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
|
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
|
||||||
BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
|
BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -29,10 +29,10 @@ import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects beans of type
|
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects
|
||||||
* {@link WebSocketMessageBrokerConfigurer}
|
* beans of type {@link WebSocketMessageBrokerConfigurer} and delegates to all
|
||||||
* and delegates to all of them allowing callback style customization of the
|
* of them allowing callback style customization of the configuration provided
|
||||||
* configuration provided in {@link WebSocketMessageBrokerConfigurationSupport}.
|
* in {@link WebSocketMessageBrokerConfigurationSupport}.
|
||||||
*
|
*
|
||||||
* <p>This class is typically imported via {@link EnableWebSocketMessageBroker}.
|
* <p>This class is typically imported via {@link EnableWebSocketMessageBroker}.
|
||||||
*
|
*
|
||||||
|
|
@ -42,10 +42,10 @@ import org.springframework.util.CollectionUtils;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMessageBrokerConfigurationSupport {
|
public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMessageBrokerConfigurationSupport {
|
||||||
|
|
||||||
private List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>();
|
private final List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>();
|
||||||
|
|
||||||
|
|
||||||
@Autowired(required=false)
|
@Autowired(required = false)
|
||||||
public void setConfigurers(List<WebSocketMessageBrokerConfigurer> configurers) {
|
public void setConfigurers(List<WebSocketMessageBrokerConfigurer> configurers) {
|
||||||
if (!CollectionUtils.isEmpty(configurers)) {
|
if (!CollectionUtils.isEmpty(configurers)) {
|
||||||
this.configurers.addAll(configurers);
|
this.configurers.addAll(configurers);
|
||||||
|
|
@ -55,51 +55,51 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerStompEndpoints(StompEndpointRegistry registry) {
|
protected void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.registerStompEndpoints(registry);
|
configurer.registerStompEndpoints(registry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureWebSocketTransport(WebSocketTransportRegistration registration) {
|
protected void configureWebSocketTransport(WebSocketTransportRegistration registration) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.configureWebSocketTransport(registration);
|
configurer.configureWebSocketTransport(registration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureClientInboundChannel(ChannelRegistration registration) {
|
protected void configureClientInboundChannel(ChannelRegistration registration) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.configureClientInboundChannel(registration);
|
configurer.configureClientInboundChannel(registration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureClientOutboundChannel(ChannelRegistration registration) {
|
protected void configureClientOutboundChannel(ChannelRegistration registration) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.configureClientOutboundChannel(registration);
|
configurer.configureClientOutboundChannel(registration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.addArgumentResolvers(argumentResolvers);
|
configurer.addArgumentResolvers(argumentResolvers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
|
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.addReturnValueHandlers(returnValueHandlers);
|
configurer.addReturnValueHandlers(returnValueHandlers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
|
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) {
|
||||||
boolean registerDefaults = true;
|
boolean registerDefaults = true;
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
if (!c.configureMessageConverters(messageConverters)) {
|
if (!configurer.configureMessageConverters(messageConverters)) {
|
||||||
registerDefaults = false;
|
registerDefaults = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -108,8 +108,8 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureMessageBroker(MessageBrokerRegistry registry) {
|
protected void configureMessageBroker(MessageBrokerRegistry registry) {
|
||||||
for (WebSocketMessageBrokerConfigurer c : this.configurers) {
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) {
|
||||||
c.configureMessageBroker(registry);
|
configurer.configureMessageBroker(registry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue