Announcement Announcement Module
Collapse
No announcement yet.
bug in FieldRetrievingFactoryBean in spring 2.0? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • bug in FieldRetrievingFactoryBean in spring 2.0?

    hi,

    is this intended or is it a bug in spring 2.0 (i think this worked in spring 1.2.x):

    want to read out the same static field several times:

    <bean id="C" class="test.C">
    <property name="member1"><util:constant static-field="test.A.CONSTANT1"/></property>
    </bean>


    <bean id="SecondC" class="test.C">
    <property name="member1"><util:constant static-field="test.A.CONSTANT1"/></property>
    </bean>

    leads to

    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'test.A.CONSTANT1' defined in null: Cannot register bean definition [Root bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean];
    ... for bean 'test.A.CONSTANT1':
    there's already [Root bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; ...bound


    if i reference the static field definition the second time, it is working (beanDefinitionOverriding is not allowed in my beanFactory):

    <bean id="SecondC" class="test.C">
    <property name="member1"><ref bean="test.A.CONSTANT1"/></property>
    </bean>

  • #2
    Perhaps this has something to do with the fact that the bean names are equal. However, for inner beans this scenario should work.

    Maybe you should check Jira if an according issue already exists. Otherwise please make a report about it there (ideally providing a small testcase).

    Regards,
    Andreas

    Comment

    Working...
    X