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

Ability to create proxy around classes that has no default constructor. #290

Closed
wants to merge 1 commit into from

Conversation

Fuud
Copy link

@Fuud Fuud commented May 24, 2013

There is some limitations in current proxy instantiation model:

  1. class should have default constructor (but sprint supports autowiring constructor arguments for object itself)
  2. calling the constructor can cause side-effects
  3. if constructor throws an exception proxy will not be created.

Also in current implementation there is serialization problem: if target class implements java.io.Externalizable then no proxy fields will be stored and restored object will be invalid.

Note that proxy does not need to have any valid state at all.

Solution is to use Objenesis library ( http://objenesis.googlecode.com/svn/docs/index.html ). It can instantiate objects without calling any constructor.

For serialization issue proxy should implement java.io.Externalizable and save/restore properties in writeExternal/readExternal methods.

@Fuud
Copy link
Author

Fuud commented May 24, 2013

I have signed and agree to the terms of the SpringSource Individual
Contributor License Agreement.

@philwebb
Copy link
Member

Hi @Fuud,

Could you please raise a JIRA issue for this. My initial thoughts are that the current restrictions are probably preferable to adding a new dependency on Objenesis for most people, but JIRA is probably the best place for these discussions.

@Fuud
Copy link
Author

Fuud commented May 28, 2013

Ok.
Lets discuss at https://jira.springsource.org/browse/SPR-10594

@Fuud
Copy link
Author

Fuud commented Jul 4, 2013

There is no comments on issue for a month. Is pull request processing works in Spring Source?

@Fuud
Copy link
Author

Fuud commented Sep 24, 2013

@philwebb Can you please close this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants