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

xml-parent vs. No equivalent Annotation [SPR-5580] #10251

Closed
spring-projects-issues opened this issue Mar 17, 2009 · 4 comments
Closed

xml-parent vs. No equivalent Annotation [SPR-5580] #10251

spring-projects-issues opened this issue Mar 17, 2009 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 17, 2009

Paul Bacsik opened SPR-5580 and commented

This works:
<bean id="parentBean" class="AbstractCls" abstract="true"><property name="setter" value="basicString"/>....
<bean class="SubClsExtendsAbstractCls" parent="parentBean"> ...

This does not work - setter is not called:
<bean id="parentBean" class="AbstractCls" abstract="true"><property name="setter" value="basicString"/>....
@Component public class SubClsExtendsAbstractCls extends AbstractCls { ...

Nice would be:
@Component(parent="parentBean")


Affects: 2.5.6

Sub-tasks:

5 votes, 6 watchers

@spring-projects-issues
Copy link
Collaborator Author

Eugen Paraschiv commented

Is there any new development on this? It seems like a basic configuration requirement.
Thanks.

@spring-projects-issues
Copy link
Collaborator Author

Roberto Ruiz commented

@ChildOf solution proposed in sub-task is probably the best one.
That way, there is no need to add the "parent" attribute if you have made your own stereotypes

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Check this thread

@spring-projects-issues
Copy link
Collaborator Author

xorcus commented

I have a situation where a given interface is implemented by arbitrary service provides. All implementations of the interface are being autowired into a component using them. This is the original product.

Now external to this, I have a customization project which needs to customize the behavior of one specific service provider implementation provided by the original product, but without touching its original source code (the original product is added to classpath as a jar). Effectively, I need to create another component implementing the same interface, but instead of adding it to the bunch of existing implementations, I need to instruct spring to use the original one as a parent, and still preserve its id. In other words, replace the original service provider instance with a customized version without affecting any other implementation.

I believe the description from the linked thread does not cover such a case and the need for @Component(parent=...) or @ChildOf() still exists.

@spring-projects-issues spring-projects-issues added status: invalid An issue that we don't feel is valid type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: enhancement A general enhancement label Jan 12, 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) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants