Results 1 to 2 of 2

Thread: Map entries from different sources

  1. #1
    Join Date
    Jan 2005
    Location
    Austria
    Posts
    20

    Default Map entries from different sources

    Hi,

    I have the requirement to set up a map with standard and customer entries from different files. Example:

    File1.xml:
    <!-- Standard entries -->
    <bean id="converterFactory" class="ConverterFactory">
    <property name="converterMap">
    <map>
    <entry key="java.lang.String">
    <ref bean="StringConverter"/>
    </entry>
    <entry key="java.lang.Boolean">
    <ref bean="BooleanConverter"/>
    </entry>
    </map>
    </property>
    </bean>
    <bean id="StringConverter" class="StringConverter"/>
    <bean id="BooleanConverter" class="BooleanConverter"/>

    File2.xml:
    <!-- Customer entries -->
    <import resource="File2.xml"/>
    <bean id="converterFactory" class="ConverterFactory">
    <property name="converterMap">
    <map>
    <entry key="BKUnbestaetigtesGeburtsdatum">
    <ref bean="BKUnbestaetigtesGeburtsdatumConverter"/>
    </entry>
    </map>
    </property>
    </bean>
    <bean id="BKUnbestaetigtesGeburtsdatumConverter" class="BkUnbestaetigtesGeburtsdatumConverter"/>

    I know that I cannot use the same id name for both, but how can I arrange the given requirement? I tried with parent, but then the second definition overrides the first one?

    Any ideas?

    Thx Rene

  2. #2
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Define the two maps with different id's, and use a BeanPostProcessor to merge one into another.
    --Jing Xue

Similar Threads

  1. BeanDef : merging List/map entries
    By samema in forum Container
    Replies: 2
    Last Post: Aug 22nd, 2005, 10:32 AM
  2. Combining map entries
    By thorst in forum Container
    Replies: 5
    Last Post: Jul 15th, 2005, 10:45 AM
  3. Multiple Data Sources + Hibernate + Spring
    By joeserel in forum Data
    Replies: 2
    Last Post: May 18th, 2005, 09:22 AM
  4. Multiple data sources in Spring
    By Yeshaswi in forum Data
    Replies: 1
    Last Post: May 4th, 2005, 04:34 AM
  5. Replies: 3
    Last Post: Apr 21st, 2005, 03:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •