Polishing
This commit is contained in:
parent
e78b0860df
commit
595cdf05e9
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.transaction.aspectj;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.junit.Before;
|
||||
|
|
@ -132,6 +131,7 @@ public class JtaTransactionAspectsTests {
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected static class JtaAnnotationProtectedAnnotatedMember {
|
||||
|
||||
public void doSomething() {
|
||||
|
|
@ -143,6 +143,7 @@ public class JtaTransactionAspectsTests {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected static class JtaAnnotationPrivateAnnotatedMember {
|
||||
|
||||
public void doSomething() {
|
||||
|
|
@ -154,6 +155,7 @@ public class JtaTransactionAspectsTests {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
protected static class Config {
|
||||
|
||||
|
|
@ -168,7 +170,6 @@ public class JtaTransactionAspectsTests {
|
|||
aspect.setTransactionManager(transactionManager());
|
||||
return aspect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.lang.reflect.Array;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
|
@ -1179,7 +1180,12 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
|||
throw new TypeMismatchException(propertyChangeEvent, pd.getPropertyType(), ex.getTargetException());
|
||||
}
|
||||
else {
|
||||
throw new MethodInvocationException(propertyChangeEvent, ex.getTargetException());
|
||||
Throwable cause = ex.getTargetException();
|
||||
if (cause instanceof UndeclaredThrowableException) {
|
||||
// May happen e.g. with Groovy-generated methods
|
||||
cause = cause.getCause();
|
||||
}
|
||||
throw new MethodInvocationException(propertyChangeEvent, cause);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -162,13 +162,12 @@ public @interface EnableCaching {
|
|||
* Indicate whether subclass-based (CGLIB) proxies are to be created as opposed
|
||||
* to standard Java interface-based proxies. The default is {@code false}. <strong>
|
||||
* Applicable only if {@link #mode()} is set to {@link AdviceMode#PROXY}</strong>.
|
||||
*
|
||||
* <p>Note that setting this attribute to {@code true} will affect <em>all</em>
|
||||
* Spring-managed beans requiring proxying, not just those marked with
|
||||
* {@code @Cacheable}. For example, other beans marked with Spring's
|
||||
* {@code @Transactional} annotation will be upgraded to subclass proxying at the same
|
||||
* time. This approach has no negative impact in practice unless one is explicitly
|
||||
* expecting one type of proxy vs another, e.g. in tests.
|
||||
* Spring-managed beans requiring proxying, not just those marked with {@code @Cacheable}.
|
||||
* For example, other beans marked with Spring's {@code @Transactional} annotation will
|
||||
* be upgraded to subclass proxying at the same time. This approach has no negative
|
||||
* impact in practice unless one is explicitly expecting one type of proxy vs another,
|
||||
* e.g. in tests.
|
||||
*/
|
||||
boolean proxyTargetClass() default false;
|
||||
|
||||
|
|
@ -185,4 +184,5 @@ public @interface EnableCaching {
|
|||
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
|
||||
*/
|
||||
int order() default Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -24,7 +24,6 @@ import groovy.lang.MetaClass;
|
|||
import groovy.lang.Script;
|
||||
import org.codehaus.groovy.control.CompilationFailedException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
|
@ -102,7 +101,7 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
|
|||
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
((ConfigurableListableBeanFactory) beanFactory).ignoreDependencyType(MetaClass.class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -94,7 +94,7 @@ import org.springframework.util.StringUtils;
|
|||
* <property name="message" value="Hello World!"/>
|
||||
* </bean>
|
||||
*
|
||||
* <bean id="groovyMessenger" class="org.springframework.scripting.bsh.GroovyScriptFactory">
|
||||
* <bean id="groovyMessenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
* <constructor-arg value="classpath:mypackage/Messenger.groovy"/>
|
||||
* <property name="message" value="Hello World!"/>
|
||||
* </bean></pre>
|
||||
|
|
@ -346,17 +346,16 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
|||
* @param scriptedObjectBeanName the name of the internal scripted object bean
|
||||
*/
|
||||
protected void prepareScriptBeans(BeanDefinition bd, String scriptFactoryBeanName, String scriptedObjectBeanName) {
|
||||
|
||||
// Avoid recreation of the script bean definition in case of a prototype.
|
||||
synchronized (this.scriptBeanFactory) {
|
||||
if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {
|
||||
|
||||
this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName,
|
||||
createScriptFactoryBeanDefinition(bd));
|
||||
ScriptFactory scriptFactory = this.scriptBeanFactory
|
||||
.getBean(scriptFactoryBeanName, ScriptFactory.class);
|
||||
ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName,
|
||||
scriptFactory.getScriptSourceLocator());
|
||||
this.scriptBeanFactory.registerBeanDefinition(
|
||||
scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd));
|
||||
ScriptFactory scriptFactory =
|
||||
this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
|
||||
ScriptSource scriptSource =
|
||||
getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
|
||||
Class<?>[] interfaces = scriptFactory.getScriptInterfaces();
|
||||
|
||||
Class<?>[] scriptedInterfaces = interfaces;
|
||||
|
|
@ -365,8 +364,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
|||
scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface);
|
||||
}
|
||||
|
||||
BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource,
|
||||
scriptedInterfaces);
|
||||
BeanDefinition objectBd = createScriptedObjectBeanDefinition(
|
||||
bd, scriptFactoryBeanName, scriptSource, scriptedInterfaces);
|
||||
long refreshCheckDelay = resolveRefreshCheckDelay(bd);
|
||||
if (refreshCheckDelay >= 0) {
|
||||
objectBd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||
|
|
@ -569,7 +568,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
|||
proxyFactory.setInterfaces(interfaces);
|
||||
if (proxyTargetClass) {
|
||||
classLoader = null; // force use of Class.getClassLoader()
|
||||
proxyFactory.setProxyTargetClass(proxyTargetClass);
|
||||
proxyFactory.setProxyTargetClass(true);
|
||||
}
|
||||
|
||||
DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
|
||||
|
|
|
|||
Loading…
Reference in New Issue