Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-3542

scope (& similar attributes) on abstract beans should be inherited in child beans, or not permitted

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1 M2
    • Fix Version/s: 3.0 RC2
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      Hi,

      given this config:

      <bean id="parent" scope="prototype" abstract="true">
      <property name="prop" ref="prop" />
      .....
      </bean>

      <bean id="child1" parent="parent" class="X" />
      <bean id="child2" parent="parent" class="X" />
      <bean id="child3" parent="parent" scope="singleton" class="X" />

      the prototype attribute on the abstract parent does not carry down to any child beans. So child1 & 2 here are scoped singleton, wouldn't it make sense to inherit that? I am not sure, just throwing this out there for someone to consider. If it does, the child beans could also override scope and the similar attributes.

      If it doesn't make sense, abstract="true" & scope="*" should probably generate an xml error since they will be a waste of typing.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                john John Newman
                Last updater:
                St├ęphane Nicoll
              • Votes:
                8 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 years, 28 weeks, 4 days ago