Lets say I have a configuration:
The last one wins.
Assuming we have props1.properties as
prop1=val1
and props2.properties
prop1=val2
and context.xml
/props1.properties
/props2.properties
then
public class Test1 {
@Value("${prop1}")
String prop1;
public static void main(String[] args) throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("/test1.xml");
System.out.println(ctx.getBean(Test1.class).prop1);
}
}
prints
val2
and if we change context as
/props2.properties
/props1.properties
the same test prints
val1