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

ProxyFactoryBean does not work with prototype advisors/interceptors [SPR-328] #5058

Closed
spring-projects-issues opened this issue Sep 11, 2004 · 2 comments
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

Chris Eldredge opened SPR-328 and commented

There are several issues in the ProxyFactoryBean which prevent it from correctly creating beans with prototype advisors:

-Cannot create proxy when using prototype advisor when singleton=false
-Cannot create proxy when using prototype interceptor when singletone=false
-Cannot create proxy when using singleton target and singleton=false (ie, to use a prototype advisor on a singleton target)

Essentially, at the moment the only part of a prototype ProxyFactoryBean which may be a prototype is the target bean.

When trying to use a prototype the following exception is thrown:

BeanCreationException: Error creating bean with name 'prototypeTestBeanProxySingletonTarget' defined in class path resource [proxyFactoryTests.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: TargetSource specified more than once: Specify in targetSource property or at the END of the interceptorNames list
...

Note that in targetSource is not actually specified more than once.

The main defect is that when the factory is initialized, it avoids loading prototype beans which appear in the interceptorNames property in order to improve performance. Instead it substitutes a null value. When this null value is later examined, it cannot be determined whether the bean was supposed to be a target or an advisor.


Affects: 1.1.1

Attachments:

@spring-projects-issues
Copy link
Collaborator Author

Chris Eldredge commented

patch against build 96 which resolves all issues.

@spring-projects-issues
Copy link
Collaborator Author

Chris Eldredge commented

Updated patch generated on 13 Sept 2004. For some reason, previous patch does not apply cleanly.

@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 10, 2019
@spring-projects-issues spring-projects-issues added this to the 1.1.1 milestone Jan 10, 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

1 participant