Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AopUtils.getTargetClass assumes cglib proxies are always proxying classes [SPR-5694] #10364

Closed
spring-projects-issues opened this issue Apr 22, 2009 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Iwein Fuld opened SPR-5694 and commented

If you create a cglib proxy for an interface using a third party framework AopUtils will break see INT-654.

Test to demonstrate:

import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import org.junit.Test;
import org.springframework.aop.support.AopUtils;

public class AopUtilsMockitoTests {

	@Test
	@SuppressWarnings("unchecked")
	public void getTargetClass() throws Exception {
		AnInterface candidate = mock(AnInterface.class);
		assertTrue(AnInterface.class.isAssignableFrom(candidate.getClass()));
		assertTrue(AnInterface.class.isAssignableFrom(AopUtils.getTargetClass(candidate)));
	}

	private interface AnInterface {	}
}

This was tested with Mockito 1.7


Affects: 2.5.6

Issue Links:

  • INT-645 HandlerMethodUtils doesn't resolve handler methods on cglib proxies ("is depended on by")

Referenced from: commits 8583026

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 M3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants