0

I am using Spring(3.1) profiles to load property files vis util:properties:

<beans profile="local">
    <util:properties id="myProps"  
                     location="classpath:local.properties" />
</beans>
<beans profile="dev">
    <util:properties id="myProps"  
                     location="classpath:dev.properties" />
</beans>

And I invoke the profile via a runtime parameter(running on TC Server):-Dspring.profiles.active=local

But I get the error There are multiple occurrences of ID value 'myProps'

This was running previously with other bean definitions but once the util:properties was added I get the error.

enkor
  • 7,527
  • 3
  • 31
  • 55

1 Answers1

1

Make sure your xsd declarations are using >= 3.1 versions for both beans and util namespaces:

xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util-3.1.xsd  ">

Most likely cause of error would be forgetting to set util declaration to 3.1, if as you say this works for other beans but not those declared using util.

Stephen Hartley
  • 945
  • 1
  • 11
  • 17