Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: HELP IoC problem

  1. #11
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Your setter/getter has to be of the same type with the internal field.

    private Map exchangeCodes ;

    public Map getExchangeCodes() {
    return exchangeCodes;
    }
    You can however have a set
    private Set exchangeCodes;

    public Set getExchangeCodes() {
    return exchangeCodes.keySet();
    }
    but then you have to transform the map into a set. You can do this by using a factory-method inside Spring xml:

    Code:
       <bean id="properties.factory" class="org.springframework.beans.factory.config.PropertiesFactoryBean>
          <property name="location" value="classpath:myValues.properties"/>
    </bean>
    ...
    <property name="exchangeCodes">
    <bean factory-bean="propertiesFactory"
          factory-method="keySet"/></property>
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  2. #12

    Default

    Hi Costin,

    Thanks for all your help. I tried but cannot make it work. deadline is coming. Will come back to this some other time.

    Regards
    Richard

Posting Permissions

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