Reputation: 4102
I have an @Configuration class. This class, has a @PropertySource.
I want to have one different property to each application.
Example:
@Configuration
@PropertySource("file:${my.properties-file}")
public class Config {
}
I want to configure each property to each application via it context name.
My application server directory structure:
webapps/
my-app-a.war
my-app-b.war
Both (my-app-a.war and my-app-b.war) are the same web application, the difference is that they are deployed twices in different contexts.
For that reason, I need to configure this 2 properties:
my.properties.my-app-a=/source/properties/a.properties
my.properties.my-app-b=/source/properties/b.properties
How can I create a custom property source resolver to inject/consider the application context name to load the properties file?
Upvotes: 2
Views: 528
Reputation: 4102
I solved setting a context configuration per-application.
Apache Tomcat 8 Configuration Reference - Defining a context
Upvotes: 1
Reputation: 131
Did you try using spring profiles? Or with maven you can put your properties in the pom, and based on the profile to build your war they will be inserted in the properties file
Upvotes: 0