AspectJExpressionPointcut consistently resolves superinterface methods

Includes efficient check for same ClassLoader in ClassUtils.isVisible, efficient MethodMatchers check for IntroductionAwareMethodMatcher, and supertype method resolution in MethodMapTransactionAttributeSource.

Issue: SPR-16723
This commit is contained in:
Juergen Hoeller
2018-04-14 15:10:05 +02:00
parent c6ed41ec47
commit b95e05db04
13 changed files with 179 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 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.
@@ -45,7 +45,6 @@ import org.springframework.transaction.TransactionStatus;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
/**
* Test cases for AOP transaction management.
*
@@ -67,7 +66,7 @@ public class BeanFactoryTransactionTests {
@Test
public void testGetsAreNotTransactionalWithProxyFactory1() throws NoSuchMethodException {
public void testGetsAreNotTransactionalWithProxyFactory1() {
ITestBean testBean = (ITestBean) factory.getBean("proxyFactory1");
assertTrue("testBean is a dynamic proxy", Proxy.isProxyClass(testBean.getClass()));
assertFalse(testBean instanceof TransactionalProxy);
@@ -75,7 +74,7 @@ public class BeanFactoryTransactionTests {
}
@Test
public void testGetsAreNotTransactionalWithProxyFactory2DynamicProxy() throws NoSuchMethodException {
public void testGetsAreNotTransactionalWithProxyFactory2DynamicProxy() {
this.factory.preInstantiateSingletons();
ITestBean testBean = (ITestBean) factory.getBean("proxyFactory2DynamicProxy");
assertTrue("testBean is a dynamic proxy", Proxy.isProxyClass(testBean.getClass()));
@@ -84,7 +83,7 @@ public class BeanFactoryTransactionTests {
}
@Test
public void testGetsAreNotTransactionalWithProxyFactory2Cglib() throws NoSuchMethodException {
public void testGetsAreNotTransactionalWithProxyFactory2Cglib() {
ITestBean testBean = (ITestBean) factory.getBean("proxyFactory2Cglib");
assertTrue("testBean is CGLIB advised", AopUtils.isCglibProxy(testBean));
assertTrue(testBean instanceof TransactionalProxy);
@@ -92,7 +91,7 @@ public class BeanFactoryTransactionTests {
}
@Test
public void testProxyFactory2Lazy() throws NoSuchMethodException {
public void testProxyFactory2Lazy() {
ITestBean testBean = (ITestBean) factory.getBean("proxyFactory2Lazy");
assertFalse(factory.containsSingleton("target"));
assertEquals(666, testBean.getAge());
@@ -100,7 +99,7 @@ public class BeanFactoryTransactionTests {
}
@Test
public void testCglibTransactionProxyImplementsNoInterfaces() throws NoSuchMethodException {
public void testCglibTransactionProxyImplementsNoInterfaces() {
ImplementsNoInterfaces ini = (ImplementsNoInterfaces) factory.getBean("cglibNoInterfaces");
assertTrue("testBean is CGLIB advised", AopUtils.isCglibProxy(ini));
assertTrue(ini instanceof TransactionalProxy);
@@ -116,7 +115,7 @@ public class BeanFactoryTransactionTests {
}
@Test
public void testGetsAreNotTransactionalWithProxyFactory3() throws NoSuchMethodException {
public void testGetsAreNotTransactionalWithProxyFactory3() {
ITestBean testBean = (ITestBean) factory.getBean("proxyFactory3");
assertTrue("testBean is a full proxy", testBean instanceof DerivedTestBean);
assertTrue(testBean instanceof TransactionalProxy);
@@ -202,7 +201,7 @@ public class BeanFactoryTransactionTests {
* Test that we can set the target to a dynamic TargetSource.
*/
@Test
public void testDynamicTargetSource() throws NoSuchMethodException {
public void testDynamicTargetSource() {
// Install facade
CallCountingTransactionManager txMan = new CallCountingTransactionManager();
PlatformTransactionManagerFacade.delegate = txMan;