java - @PropertySource and Application context name -


i have @configuration class. class, has @propertysource.

i want have 1 different property each application.

example:

@configuration @propertysource("file:${my.properties-file}") public class config { } 

i want configure each property each application via context name.

my application server directory structure:

webapps/      my-app-a.war      my-app-b.war 

both (my-app-a.war , my-app-b.war) same web application, difference deployed twices in different contexts.

for reason, need configure 2 properties:

my.properties.my-app-a=/source/properties/a.properties my.properties.my-app-b=/source/properties/b.properties 

how can create custom property source resolver inject/consider application context name load properties file?

did try using spring profiles? or maven can put properties in pom, , based on profile build war inserted in properties file


Comments