PDA

View Full Version : Registering aliases for a bean with scope prototype



pranayku
Jun 29th, 2010, 10:10 AM
Hi All,

We are migrating from spring 3.0.M3 to spring 3.0.2. We had a configuration as :--


<bean id="componentDataBuilder"
class="mvc.components.DefaultComponentDataBuilder"
scope="prototype">
<property name="componentDataConverter" ref="componentDataConverter" />
</bean>

<bean class="example.search.mvc.builders.SearchDataBuilder" parent="componentDataBuilder" >
<property name="searchService" ref="searchService" />
</bean>

The prototype bean is getting created with the default alias name. We have our own implementation of BeanPostProcessor.postProcessAfterInitialization to register a new alias(dpeneding on our business logic). For a bean with singleton scope 'postProcessAfterInitialization()' is called, but it is not being called for a bean with prototype scope.

This configuration was working till 3.0.M3 as 'SearchDataBuilder' and we were assuming it to be prototype scope. But with adoption of 3.0.2, we realised that the "SearchDataBuilder" was having singleton scope in previous versions. I can find that this issue is fixed by SPR-3542 (http://jira.springframework.org/browse/SPR-3542).

Do I need to change any of my configuration so that BeanPostProcessor.postProcessAfterInitialization will be called for prototype scope as well?
Thanks,
Pranay

pranayku
Jun 30th, 2010, 12:59 AM
it seems i had posted it to the wrong group... i am moving this to Spring Community Forums > Core Spring Projects > Core Container.