Skip to content

Commit

Permalink
Merge branch '3.2.x' into cleanup-3.2.x
Browse files Browse the repository at this point in the history
* 3.2.x: (111 commits)
  Fix FreeMarker form checbox macro generated names
  Fix DefaultMockMvcBuilder fluent API generic type
  Catch IAE when parsing content type
  Update @RequestParam javadoc
  Fix AntPathMatcher rule for combining with extensions
  DefaultLobHandler etc
  Minor javadoc updates
  Deprecated OracleLobHandler in favor of DefaultLobHandler for the Oracle 10g driver and higher
  Added "createTemporaryLob" flag to DefaultLobHandler, using JDBC 4.0's createBlob/Clob mechanism
  Add Castor XSD information to reference docs
  Do not use Servlet 3.0 API in doOptions()
  Cache target type per bean definition and allow for specifying it in advance
  Mentioning JDBC 4's unwrap method for obtaining the native connection now
  LazyConnectionDataSourceProxy catches setReadOnly exception analogous to DataSourceUtils
  Refined predictBeanType's typesToMatch check for FactoryBeans
  Fix minor javadoc typos
  Fix incorrect closing <web-app> tag in MVC docs
  Fixed minor typo
  Suppress warnings for resource leaks
  Update spring-test re: deprecated queryForInt()
  ...
  • Loading branch information
philwebb committed Mar 4, 2013
2 parents 2642cf2 + ba03d5b commit a399b13
Show file tree
Hide file tree
Showing 205 changed files with 4,668 additions and 2,650 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ buildscript {
}
dependencies {
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.3")
classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.4")
classpath("org.springframework.build.gradle:docbook-reference-plugin:0.2.6")
}
}

configure(allprojects) { project ->
group = "org.springframework"
version = qualifyVersionIfNecessary(version)

ext.aspectjVersion = "1.7.1"
ext.aspectjVersion = "1.7.2"
ext.easymockVersion = "2.5.2"
ext.hsqldbVersion = "1.8.0.10"
ext.junitVersion = "4.11"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand Down Expand Up @@ -110,7 +110,7 @@ class MergePlugin implements Plugin<Project> {

// update 'into' project artifacts to contain the source artifact contents
project.merge.into.sourcesJar.from(project.sourcesJar.source)
project.merge.into.jar.from(project.jar.source)
project.merge.into.jar.from(project.sourceSets.main.output)
project.merge.into.javadoc {
source += project.javadoc.source
classpath += project.javadoc.classpath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand All @@ -17,8 +17,8 @@
package org.springframework.aop.interceptor;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;

import org.springframework.beans.BeansException;
Expand All @@ -45,7 +45,7 @@
*/
public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {

private final Map<Method, AsyncTaskExecutor> executors = new HashMap<Method, AsyncTaskExecutor>();
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<Method, AsyncTaskExecutor>(16);

private Executor defaultExecutor;

Expand All @@ -59,7 +59,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
* @param defaultExecutor the executor to use when executing asynchronous methods
*/
public AsyncExecutionAspectSupport(Executor defaultExecutor) {
this.setExecutor(defaultExecutor);
this.defaultExecutor = defaultExecutor;
}


Expand Down Expand Up @@ -90,24 +90,25 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
* @return the executor to use (never {@code null})
*/
protected AsyncTaskExecutor determineAsyncExecutor(Method method) {
if (!this.executors.containsKey(method)) {
Executor executor = this.defaultExecutor;
AsyncTaskExecutor executor = this.executors.get(method);
if (executor == null) {
Executor executorToUse = this.defaultExecutor;
String qualifier = getExecutorQualifier(method);
if (StringUtils.hasLength(qualifier)) {
Assert.notNull(this.beanFactory,
"BeanFactory must be set on " + this.getClass().getSimpleName() +
" to access qualified executor [" + qualifier + "]");
executor = BeanFactoryAnnotationUtils.qualifiedBeanOfType(
Assert.notNull(this.beanFactory, "BeanFactory must be set on " + getClass().getSimpleName() +
" to access qualified executor '" + qualifier + "'");
executorToUse = BeanFactoryAnnotationUtils.qualifiedBeanOfType(
this.beanFactory, Executor.class, qualifier);
}
if (executor instanceof AsyncTaskExecutor) {
this.executors.put(method, (AsyncTaskExecutor) executor);
}
else if (executor != null) {
this.executors.put(method, new TaskExecutorAdapter(executor));
else if (executorToUse == null) {
throw new IllegalStateException("No executor qualifier specified and no default executor set on " +
getClass().getSimpleName() + " either");
}
executor = (executorToUse instanceof AsyncTaskExecutor ?
(AsyncTaskExecutor) executorToUse : new TaskExecutorAdapter(executorToUse));
this.executors.put(method, executor);
}
return this.executors.get(method);
return executor;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
Expand All @@ -17,16 +17,18 @@
package org.springframework.aop.interceptor;

import java.lang.reflect.Method;

import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import org.springframework.aop.support.AopUtils;
import org.springframework.core.BridgeMethodResolver;
import org.springframework.core.Ordered;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;

/**
Expand Down Expand Up @@ -76,7 +78,11 @@ public AsyncExecutionInterceptor(Executor executor) {
* otherwise.
*/
public Object invoke(final MethodInvocation invocation) throws Throwable {
Future<?> result = this.determineAsyncExecutor(invocation.getMethod()).submit(
Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);
Method specificMethod = ClassUtils.getMostSpecificMethod(invocation.getMethod(), targetClass);
specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);

Future<?> result = determineAsyncExecutor(specificMethod).submit(
new Callable<Object>() {
public Object call() throws Exception {
try {
Expand All @@ -91,6 +97,7 @@ public Object call() throws Exception {
return null;
}
});

if (Future.class.isAssignableFrom(invocation.getMethod().getReturnType())) {
return result;
}
Expand All @@ -100,10 +107,9 @@ public Object call() throws Exception {
}

/**
* {@inheritDoc}
* <p>This implementation is a no-op for compatibility in Spring 3.1.2. Subclasses may
* override to provide support for extracting qualifier information, e.g. via an
* annotation on the given method.
* This implementation is a no-op for compatibility in Spring 3.1.2.
* Subclasses may override to provide support for extracting qualifier information,
* e.g. via an annotation on the given method.
* @return always {@code null}
* @see #determineAsyncExecutor(Method)
* @since 3.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.beans.factory.aspectj;

import org.aspectj.lang.annotation.SuppressAjWarnings;
Expand All @@ -23,12 +23,12 @@ import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
* Abstract superaspect for AspectJ aspects that can perform Dependency
* Injection on objects, however they may be created. Define the beanCreation()
* pointcut in subaspects.
*
*
* <p>Subaspects may also need a metadata resolution strategy, in the
* <code>BeanWiringInfoResolver</code> interface. The default implementation
* {@code BeanWiringInfoResolver} interface. The default implementation
* looks for a bean with the same name as the FQN. This is the default name
* of a bean in a Spring container if the id value is not supplied explicitly.
*
*
* @author Rob Harrop
* @author Rod Johnson
* @author Adrian Colyer
Expand Down Expand Up @@ -62,7 +62,7 @@ public abstract aspect AbstractBeanConfigurerAspect extends BeanConfigurerSuppor

/**
* The initialization of a new object.
*
*
* <p>WARNING: Although this pointcut is non-abstract for backwards
* compatibility reasons, it is meant to be overridden to select
* initialization of any configurable bean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,85 +17,87 @@
package org.springframework.beans.factory.aspectj;

import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.aspectj.lang.annotation.control.CodeGenerationHint;

/**
* Abstract base aspect that can perform Dependency
* Injection on objects, however they may be created.
*
*
* @author Ramnivas Laddad
* @since 2.5.2
*/
public abstract aspect AbstractDependencyInjectionAspect {
/**
* Select construction join points for objects to inject dependencies
*/
public abstract pointcut beanConstruction(Object bean);
public abstract pointcut beanConstruction(Object bean);

/**
* Select deserialization join points for objects to inject dependencies
*/
public abstract pointcut beanDeserialization(Object bean);

/**
* Select join points in a configurable bean
*/
public abstract pointcut inConfigurableBean();

/**
* Select join points in beans to be configured prior to construction?
* By default, use post-construction injection matching the default in the Configurable annotation.
*/
public pointcut preConstructionConfiguration() : if(false);

/**
* Select the most-specific initialization join point
* Select the most-specific initialization join point
* (most concrete class) for the initialization of an instance.
*/
@CodeGenerationHint(ifNameSuffix="6f1")
public pointcut mostSpecificSubTypeConstruction() :
if(thisJoinPoint.getSignature().getDeclaringType() == thisJoinPoint.getThis().getClass());

/**
* Select least specific super type that is marked for DI (so that injection occurs only once with pre-construction inejection
*/
public abstract pointcut leastSpecificSuperTypeConstruction();

/**
* Configure the bean
*/
public abstract void configureBean(Object bean);

private pointcut preConstructionCondition() :

private pointcut preConstructionCondition() :
leastSpecificSuperTypeConstruction() && preConstructionConfiguration();

private pointcut postConstructionCondition() :
mostSpecificSubTypeConstruction() && !preConstructionConfiguration();

/**
* Pre-construction configuration.
*/
@SuppressAjWarnings("adviceDidNotMatch")
before(Object bean) :
beanConstruction(bean) && preConstructionCondition() && inConfigurableBean() {
before(Object bean) :
beanConstruction(bean) && preConstructionCondition() && inConfigurableBean() {
configureBean(bean);
}

/**
* Post-construction configuration.
*/
@SuppressAjWarnings("adviceDidNotMatch")
after(Object bean) returning :
after(Object bean) returning :
beanConstruction(bean) && postConstructionCondition() && inConfigurableBean() {
configureBean(bean);
}

/**
* Post-deserialization configuration.
*/
@SuppressAjWarnings("adviceDidNotMatch")
after(Object bean) returning :
after(Object bean) returning :
beanDeserialization(bean) && inConfigurableBean() {
configureBean(bean);
}

}
Loading

0 comments on commit a399b13

Please sign in to comment.