Consistent but local aspect instantiation in AspectJProxyFactory (4.3.x)

This commit is contained in:
Juergen Hoeller
2018-02-28 15:49:48 +01:00
parent 2c45b09263
commit 57aa3d1e3b
2 changed files with 22 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 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.
@@ -37,26 +37,26 @@ import static org.junit.Assert.*;
* @author Juergen Hoeller
* @author Chris Beams
*/
public final class ArgumentBindingTests {
public class ArgumentBindingTests {
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void testBindingInPointcutUsedByAdvice() {
TestBean tb = new TestBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
proxyFactory.addAspect(NamedPointcutWithArgs.class);
ITestBean proxiedTestBean = (ITestBean) proxyFactory.getProxy();
proxiedTestBean.setName("Supercalifragalisticexpialidocious"); // should throw
ITestBean proxiedTestBean = proxyFactory.getProxy();
proxiedTestBean.setName("Supercalifragalisticexpialidocious");
}
@Test(expected=IllegalStateException.class)
@Test(expected = IllegalStateException.class)
public void testAnnotationArgumentNameBinding() {
TransactionalBean tb = new TransactionalBean();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(tb);
proxyFactory.addAspect(PointcutWithAnnotationArgument.class);
ITransactionalBean proxiedTestBean = (ITransactionalBean) proxyFactory.getProxy();
proxiedTestBean.doInTransaction(); // should throw
ITransactionalBean proxiedTestBean = proxyFactory.getProxy();
proxiedTestBean.doInTransaction();
}
@Test
@@ -71,6 +71,7 @@ public final class ArgumentBindingTests {
assertEquals("formal", pnames[0]);
}
public void methodWithOneParam(String aParam) {
}
@@ -100,9 +101,6 @@ public final class ArgumentBindingTests {
}
/**
* @author Juergen Hoeller
*/
@Aspect
class PointcutWithAnnotationArgument {
@@ -115,9 +113,6 @@ class PointcutWithAnnotationArgument {
}
/**
* @author Adrian Colyer
*/
@Aspect
class NamedPointcutWithArgs {