photostok
photostok

Reputation: 23

Property files conflict in spring

I have the following problem

In common.xml I have included property file via

<context:property location  ="classpath:x.properties" />

In custom.xml I have imported common.xml and included another property file

<context:property location ="classpath:y.properties" />

When I try to use property placeholder from y.properties file for ex. ${my.name} I get an error that Spring could not recognize "my.name"

I can't use both property files in same xml, I can't use multiple locations

I wonder if anyone have ever used properties file in different xml files. Is this possible? Why there is a conflict, when we use 2 or more properties files?

Upvotes: 0

Views: 558

Answers (1)

ekem chitsiga
ekem chitsiga

Reputation: 5753

Use one context:property-placheolder element and specify multiple values for the location attribute for example

<context:property-placeholder location="classpath:x.properties,classpath:y.properties"/>

In your case one element is overriding the other

Upvotes: 1

Related Questions