Description
Qadeer Ahmad opened SPR-12570 and commented
In #8225, changes were made in bean inheritance regarding scope. However, the documentation about this particular bit remains unchanged:
...
The remaining settings are always taken from the child definition: depends on, autowire mode, dependency check, singleton, scope, lazy init.
The same text is found in the version prior to this change: http://docs.spring.io/spring/docs/2.5.x/reference/beans.html#beans-child-bean-definitions
With the changes in #8225, the scope property is inherited from the parent bean definition if not defined in the child. The scope property is not always taken from the child property. In my opinion this part of the documentation should be updated to explicitly describe when the scope property is inherited.
Background: I was working with a some legacy system where I updated Spring from version 2.5.x to 3.2.x. After the upgrade, many tests started to fail due to this change. After some debugging I found that the scope was not the same anymore, but I could not understand why because the documentation was the same about this part. Fortunately, I found the Jira issue and the changelog, and understood that the bean definition inheritance had actually changed.
I think the update in documentation can help others in the similar situation.
Issue Links:
- scope (& similar attributes) on abstract beans should be inherited in child beans, or not permitted [SPR-3542] #8225 scope (& similar attributes) on abstract beans should be inherited in child beans, or not permitted