Results 1 to 1 of 1

Thread: Annotation based configuration parent bean configuration equiavalent

  1. #1

    Default Bean inheritance annotation based configuration (parent)

    I would like to figure out how to configure a parent for a bean so that the container takes care of injecting the dependencies automatically without having to overwrite the setters of the parent (which is what I am currently doing) perhaps this is the intension but it would be nice if the container took care of it for me.
    sample xml configuration
    Code:
    <bean id="parentBean" class="com.example.beans.ParentBean" abstract="true">
    <property name="someServiceBean" ref="someServiceBean"/>
    </bean>
    <bean id="childBean" class="com.example.beans.ChildBean" parent="parentBean"/>
    I configure by chileBean as follows and I don't want to have to overwrite the setter(s) of the parent.

    Code:
    @Component
    public class ChildBean extends ParentBean {
    
    @Overwrite
    @Autowired
    public void setSomeServiceBean(final SomeServiceBean service) {
      super.setSomeServiceBean(service); 
    }
    PS. I found @DependsOn but I don't think it is meant for configuring bean inheritance. I would expect @Parent or something along those lines.
    Last edited by dzontak@gmail.com; Mar 8th, 2011 at 09:31 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •