Announcement Announcement Module
Collapse
No announcement yet.
Using bean id in bean itsself Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using bean id in bean itsself

    Hi!

    I already searched on google and in forums, but i couldn't find any informations about it.
    I need to set the bean id on a field on the bean itsself.
    My (dummy) code:

    Code:
    public class MyConfigEntry
    {
        private String name;
        private String startCommand;
        /*getter, setter*/
    }
    
    <beans>
    	<bean id="firstCommand" class="MyConfigEntry">
                <property name="name" value="firstCommand" />
                <property name="startCommand" value="anyCommand" />
    	</bean>
    	<bean id="secondCommand" class="MyConfigEntry">
                <property name="name" value="secondCommand" />
                <property name="startCommand" value="anyCommand" />
    	</bean>
    </beans>
    as you see i always have to write bean id and name property of MyConfigEntry twice. Is there any possibility to get the bean id into property "name"?

    i use spring 2.5.6 with jdk 1.6.0_23

    yours sincerly Phylanx

  • #2
    Well search again ... You want BeanNameAware.

    Comment


    • #3
      hi!

      thank you for your fast reply.
      it's hard to find things if you don't know the right key words.

      sry for disturbing
      1 million times thank you!
      Phylanx

      Comment

      Working...
      X