Announcement Announcement Module
Collapse
No announcement yet.
Why specify id with parent attribute in inner beans? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why specify id with parent attribute in inner beans?

    I have following when defining a constructor of a bean:

    Code:
     <constructor-arg>
          <bean id="sf1" parent="default.sessionFactory">
              <property name="dataSource">
                <bean class="org.springframework.jndi.JndiObjectFactoryBean">
                     <property name="jndiName">
                             <value>java&#58;comp/env/jdbc/ds</value>
                     </property>
                 </bean>
                </property>
           </bean>
    </constructor-arg>
    Why am I forced to name my bean (i'm calling it sf1).

    However, if I don't use the parent and define the whole bean then I don't need to specify the id (ids for inner beans are meaningless).

    I would like to treat these "inner beans" like annoymous classes where I don't need to specify ids since it should only exist in the inner portion of definition (i.e sf1 should never be accessible anywhere else).

    dino

  • #2
    Are you saying you're getting an error if you don't define the id ("sf1" in this case?). That shouldn't be the case. I would file a bug report if that's happening...

    Comment


    • #3
      Hopefully, today I will write a small app with an xml file to reproduce this problem and submit a bug report.

      DIno

      Comment


      • #4
        How do I report this as a bug?

        dino

        Comment


        • #5
          In Spring's Jira instance:

          http://opensource.atlassian.com/proj...Dashboard.jspa

          Thanks,

          Comment

          Working...
          X