parent
1259671f3f
commit
3783591083
|
@ -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.
|
||||||
|
@ -17,7 +17,6 @@
|
||||||
package org.springframework.cache.annotation;
|
package org.springframework.cache.annotation;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
|
@ -28,12 +27,11 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.ImportAware;
|
import org.springframework.context.annotation.ImportAware;
|
||||||
import org.springframework.core.annotation.AnnotationAttributes;
|
import org.springframework.core.annotation.AnnotationAttributes;
|
||||||
import org.springframework.core.type.AnnotationMetadata;
|
import org.springframework.core.type.AnnotationMetadata;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base {@code @Configuration} class providing common structure for enabling
|
* Abstract base {@code @Configuration} class providing common structure
|
||||||
* Spring's annotation-driven cache management capability.
|
* for enabling Spring's annotation-driven cache management capability.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
@ -53,13 +51,15 @@ public abstract class AbstractCachingConfiguration<C extends CachingConfigurer>
|
||||||
|
|
||||||
protected CacheErrorHandler errorHandler;
|
protected CacheErrorHandler errorHandler;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
||||||
this.enableCaching = AnnotationAttributes.fromMap(
|
this.enableCaching = AnnotationAttributes.fromMap(
|
||||||
importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false));
|
importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false));
|
||||||
Assert.notNull(this.enableCaching,
|
if (this.enableCaching == null) {
|
||||||
"@EnableCaching is not present on importing class " +
|
throw new IllegalArgumentException(
|
||||||
importMetadata.getClassName());
|
"@EnableCaching is not present on importing class " + importMetadata.getClassName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -51,7 +51,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
|
|
||||||
private static final String MBEAN_EXPORTER_BEAN_NAME = "mbeanExporter";
|
private static final String MBEAN_EXPORTER_BEAN_NAME = "mbeanExporter";
|
||||||
|
|
||||||
private AnnotationAttributes attributes;
|
private AnnotationAttributes enableMBeanExport;
|
||||||
|
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
@Override
|
@Override
|
||||||
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
||||||
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName());
|
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName());
|
||||||
this.attributes = AnnotationAttributes.fromMap(map);
|
this.enableMBeanExport = AnnotationAttributes.fromMap(map);
|
||||||
if (this.attributes == null) {
|
if (this.enableMBeanExport == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
|
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDomain(AnnotationMBeanExporter exporter) {
|
private void setupDomain(AnnotationMBeanExporter exporter) {
|
||||||
String defaultDomain = this.attributes.getString("defaultDomain");
|
String defaultDomain = this.enableMBeanExport.getString("defaultDomain");
|
||||||
if (defaultDomain != null && this.environment != null) {
|
if (defaultDomain != null && this.environment != null) {
|
||||||
defaultDomain = this.environment.resolvePlaceholders(defaultDomain);
|
defaultDomain = this.environment.resolvePlaceholders(defaultDomain);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupServer(AnnotationMBeanExporter exporter) {
|
private void setupServer(AnnotationMBeanExporter exporter) {
|
||||||
String server = this.attributes.getString("server");
|
String server = this.enableMBeanExport.getString("server");
|
||||||
if (server != null && this.environment != null) {
|
if (server != null && this.environment != null) {
|
||||||
server = this.environment.resolvePlaceholders(server);
|
server = this.environment.resolvePlaceholders(server);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupRegistrationPolicy(AnnotationMBeanExporter exporter) {
|
private void setupRegistrationPolicy(AnnotationMBeanExporter exporter) {
|
||||||
RegistrationPolicy registrationPolicy = this.attributes.getEnum("registration");
|
RegistrationPolicy registrationPolicy = this.enableMBeanExport.getEnum("registration");
|
||||||
exporter.setRegistrationPolicy(registrationPolicy);
|
exporter.setRegistrationPolicy(registrationPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.ImportAware;
|
import org.springframework.context.annotation.ImportAware;
|
||||||
import org.springframework.core.annotation.AnnotationAttributes;
|
import org.springframework.core.annotation.AnnotationAttributes;
|
||||||
import org.springframework.core.type.AnnotationMetadata;
|
import org.springframework.core.type.AnnotationMetadata;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,8 +50,10 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
|
||||||
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
||||||
this.enableAsync = AnnotationAttributes.fromMap(
|
this.enableAsync = AnnotationAttributes.fromMap(
|
||||||
importMetadata.getAnnotationAttributes(EnableAsync.class.getName(), false));
|
importMetadata.getAnnotationAttributes(EnableAsync.class.getName(), false));
|
||||||
Assert.notNull(this.enableAsync,
|
if (this.enableAsync == null) {
|
||||||
"@EnableAsync is not present on importing class " + importMetadata.getClassName());
|
throw new IllegalArgumentException(
|
||||||
|
"@EnableAsync is not present on importing class " + importMetadata.getClassName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -114,13 +114,11 @@ import org.springframework.util.ReflectionUtils;
|
||||||
* runtime processing overhead.
|
* runtime processing overhead.
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>Note that even if
|
* <p>Note that the "sessionTransacted" flag is strongly recommended over
|
||||||
* {@link org.springframework.jms.connection.JmsTransactionManager} used to
|
* {@link org.springframework.jms.connection.JmsTransactionManager}, provided
|
||||||
* only provide fully synchronized Spring transactions based
|
* that transactions do not need to be managed externally. As a consequence,
|
||||||
* on local JMS transactions, "sessionTransacted" offers now the same feature and
|
* set the transaction manager only if you are using JTA or if you need to
|
||||||
* is the recommended option when transactions are not managed externally. In
|
* synchronize with custom external transaction arrangements.
|
||||||
* other words, set the transaction manager only if you are using JTA , or
|
|
||||||
* synchronizing transactions.
|
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.springframework.context.annotation.ImportAware;
|
||||||
import org.springframework.core.annotation.AnnotationAttributes;
|
import org.springframework.core.annotation.AnnotationAttributes;
|
||||||
import org.springframework.core.type.AnnotationMetadata;
|
import org.springframework.core.type.AnnotationMetadata;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,8 +49,10 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
|
||||||
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
||||||
this.enableTx = AnnotationAttributes.fromMap(
|
this.enableTx = AnnotationAttributes.fromMap(
|
||||||
importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName(), false));
|
importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName(), false));
|
||||||
Assert.notNull(this.enableTx,
|
if (this.enableTx == null) {
|
||||||
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());
|
throw new IllegalArgumentException(
|
||||||
|
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -42,6 +42,7 @@ public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||||
|
|
||||||
private final WebMvcConfigurerComposite configurers = new WebMvcConfigurerComposite();
|
private final WebMvcConfigurerComposite configurers = new WebMvcConfigurerComposite();
|
||||||
|
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
public void setConfigurers(List<WebMvcConfigurer> configurers) {
|
public void setConfigurers(List<WebMvcConfigurer> configurers) {
|
||||||
if (configurers == null || configurers.isEmpty()) {
|
if (configurers == null || configurers.isEmpty()) {
|
||||||
|
@ -50,6 +51,7 @@ public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||||
this.configurers.addWebMvcConfigurers(configurers);
|
this.configurers.addWebMvcConfigurers(configurers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addInterceptors(InterceptorRegistry registry) {
|
protected void addInterceptors(InterceptorRegistry registry) {
|
||||||
this.configurers.addInterceptors(registry);
|
this.configurers.addInterceptors(registry);
|
||||||
|
|
Loading…
Reference in New Issue