Skip to content

Consider using javassist for proxy generation [SPR-5654] #10325

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

Closed
spring-projects-issues opened this issue Apr 6, 2009 · 15 comments
Closed
Assignees
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 6, 2009

Chris Koch opened SPR-5654 and commented

cglib doesn't appear to be an active project anymore. It'd be nice if there was a way we could specify javassist as our bytecode instrumentation utility.


Affects: 2.5.6

Attachments:

Issue Links:

39 votes, 42 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 13, 2010

Marten Deinum commented

There seem to be multiple requests (#7964, #9663) for adding javassist proxies to the spring framework instead of only cglib. Also in the forum there is some activity/questions regarding that support. Someone also implemented a working version (http://forum.springsource.org/showthread.php?t=77971) and provided it to the community.

For users which use another framework already using javassist (like hibernate, seam) this would be a nice addition to the framework, that way they would only have to rely in 1 bytecode library instead of 2.

@spring-projects-issues
Copy link
Collaborator Author

Ricardo Tercero Lozano commented

Cglib has side effects handling signed jars. See

https://jira.jboss.org/browse/JBPAPP-2971

and due to activity on proyect, it can be considered dead. I added a vote on supporting javassist instead of cglib.

@spring-projects-issues
Copy link
Collaborator Author

Nikita Koksharov commented

I suggest to use my patch for Javassist (3.12 and higher) support.

If you don't want to wait of 3.1 release or patch Spring you could just copy (JavassistAopProxy.java, JavassistAopProxyFactory.java, JavassistApplicationContext.java) sources to your own project and use JavassistApplicationContext as spring application context.

For example, if you use ContextLoaderListener in web.xml just add follow lines:

<context-param>
<param-name>contextClass</param-name>
<param-value>org.springframework.aop.framework.JavassistApplicationContext</param-value>
</context-param>

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

There have indeed been a number of requests within and without the team to either replace CGLIB or at least allow for alternatives such as javassist. We'll look at this during the 3.2 timeline.

@spring-projects-issues
Copy link
Collaborator Author

Nikita Koksharov commented

New patch version added, use 0001-from-CGLIB-to-Javassist-migration.patch.

@spring-projects-issues
Copy link
Collaborator Author

Nikita Koksharov commented

Use sources standalone-sources.zip to begin javassist usage without spring patching. Also you could send me feedback about how it works for you.

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Thanks Nikita. Will take a look when we get to handling this issue.

@spring-projects-issues
Copy link
Collaborator Author

Nikita Tovstoles commented

hello, please don't ditch cglib altogether (leave an option to keep using it, or at least profile before making the switch). we're seeing considerable perf problems with javassist in current form:
https://issues.jboss.org/browse/JASSIST-163

@spring-projects-issues
Copy link
Collaborator Author

James Shaw commented

FWIW, cglib 3.0 appears to have been released yesterday: http://sourceforge.net/projects/cglib/files/cglib3/3.0/

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Interesting, James - thanks for the heads-up. Are you seeing a changelog anywhere? Looks like there's been some serious modification to support ASM 4, but beyond that I'm not sure what's included in the release.

@spring-projects-issues
Copy link
Collaborator Author

James Shaw commented

Sorry, I couldn't find any more information than you have already.

@spring-projects-issues
Copy link
Collaborator Author

Eduardo Macarron commented

Chris, James, all I could find is this:
http://sourceforge.net/news/?group_id=56933

cglib now uses ASM4. Due to API incompatibilities in ASM4, we've bumped the cglib version number to 3.0. If you still need ASM3 or earlier, we recommend that you continue to use cglib 2.2.2.
2012-05-25 16:05:05 PDT by jmanson

@spring-projects-issues
Copy link
Collaborator Author

Will Hoover commented

MAT shows memory leaks caused by org.springframework.cglib.proxy.Enhancer using 3.2.0.RELEASE.

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Will Hoover, do you see the same against 3.2.2.RELEASE? There have been recent changes in this area. /cc Phil Webb

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

CGLIB recently saw a 3.1 release, so it is at least somewhat active...

We generally stick with our use of repackaged CGLIB, ASM and Objenesis variants for the time being. There are no concrete plans for a migration here.

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants