Spring Framework
  1. Spring Framework
  2. SPR-5467

depends-on attribute is not 'inherited' from parent beans

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.5.6
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      I'm trying to plug in a migration bean into our current context, and ideally it would like like this:

      <bean id="dataSource" .../>
      
      <bean id="transactionManager" ...>
        <property name="dataSource" ref="dataSource"/>
      </bean>
      
      <bean id="databaseMigrator" ...>
      	<property name="dataSource" ref="dataSource"/>
      </bean>
      
      <bean id="abstractDao" abstract="true" depends-on="databaseMigrator">
      	<constructor-arg ref="sportsModelDataSource"/>
      </bean>
      ... lots of child beans with parent="abstractDao" ...
      

      If I do this, I see that beans which are using the dao childs are being init-ed before the migrations are run.

      I know that there are ways to work around this:

      • declare the dependency on each child bean ( which we're doing right now )
      • declare the dependency on the services using the dao beans ( which I find tedious and incorrect )
      • create another bean-in-the-middle between the dataSource and the daos, which I find incorrect as well ( except when using e.g. hibernate session factory, but we're not )

      The intuitive way for we would be to be able to use the depends-on on the parent bean.

        Activity

        Hide
        Rossen Stoyanchev added a comment -

        This issue has been resolved through a selective bulk update, as part of a larger effort to better manage unresolved issues. To qualify for the update, the issue was either created before Spring 3.0 or affects a version older than Spring 3.0 and is not a bug.

        There is a good chance the request was made obsolete, or at least partly outdated, by changes in later versions of Spring including deprecations. It is also possible it didn't get enough traction or we didn't have enough time to address it. One way or another, we didn't get to it.

        If you believe the issue, or some aspects of it, are still relevant and worth pursuing at present you may re-open this issue or create a new one with a more up-to-date description.

        We thank you for your contributions and encourage you to become familiar with the current process of managing Spring Framework JIRA issues that has been in use for over a year.

        Show
        Rossen Stoyanchev added a comment - This issue has been resolved through a selective bulk update, as part of a larger effort to better manage unresolved issues. To qualify for the update, the issue was either created before Spring 3.0 or affects a version older than Spring 3.0 and is not a bug. There is a good chance the request was made obsolete, or at least partly outdated, by changes in later versions of Spring including deprecations. It is also possible it didn't get enough traction or we didn't have enough time to address it. One way or another, we didn't get to it. If you believe the issue, or some aspects of it, are still relevant and worth pursuing at present you may re-open this issue or create a new one with a more up-to-date description. We thank you for your contributions and encourage you to become familiar with the current process of managing Spring Framework JIRA issues that has been in use for over a year.

          People

          • Assignee:
            Unassigned
            Reporter:
            Robert Munteanu
            Last updater:
            Trevor Marshall
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 44 weeks, 2 days ago