Browse Source

Polishing

pull/1033/head
Juergen Hoeller 10 years ago
parent
commit
053ebb180e
  1. 8
      spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java
  2. 10
      spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java

8
spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactory.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2016 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.
@ -22,9 +22,9 @@ import org.springframework.aop.TargetSource;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
/** /**
* Factory for AOP proxies for programmatic use, rather than via a bean * Factory for AOP proxies for programmatic use, rather than via declarative
* factory. This class provides a simple way of obtaining and configuring * setup in a bean factory. This class provides a simple way of obtaining
* AOP proxies in code. * and configuring AOP proxy instances in custom user code.
* *
* @author Rod Johnson * @author Rod Johnson
* @author Juergen Hoeller * @author Juergen Hoeller

10
spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 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.
@ -236,18 +236,18 @@ public class CglibProxyTests extends AbstractAopProxyTests implements Serializab
@Test @Test
public void testMultipleProxiesForIntroductionAdvisor() { public void testMultipleProxiesForIntroductionAdvisor() {
TestBean target = new TestBean(); TestBean target1 = new TestBean();
target.setAge(20); target1.setAge(20);
TestBean target2 = new TestBean(); TestBean target2 = new TestBean();
target2.setAge(21); target2.setAge(21);
ITestBean proxy1 = getIntroductionAdvisorProxy(target); ITestBean proxy1 = getIntroductionAdvisorProxy(target1);
ITestBean proxy2 = getIntroductionAdvisorProxy(target2); ITestBean proxy2 = getIntroductionAdvisorProxy(target2);
assertSame("Incorrect duplicate creation of proxy classes", proxy1.getClass(), proxy2.getClass()); assertSame("Incorrect duplicate creation of proxy classes", proxy1.getClass(), proxy2.getClass());
} }
private ITestBean getIntroductionAdvisorProxy(TestBean target) { private ITestBean getIntroductionAdvisorProxy(TestBean target) {
ProxyFactory pf = new ProxyFactory(new Class<?>[] {ITestBean.class}); ProxyFactory pf = new ProxyFactory(ITestBean.class);
pf.setProxyTargetClass(true); pf.setProxyTargetClass(true);
pf.addAdvisor(new LockMixinAdvisor()); pf.addAdvisor(new LockMixinAdvisor());

Loading…
Cancel
Save