Reputation: 4778
If I am using Spring profiles in my custom Spring XD module, in order to active the profile I have to start the Spring XD container with SPRING_PROFILES_ACTIVE environment property set to the list of profiles I'd like to activate. (Is there a way to use -Dspring.profiles.active instead? don't find this option in the documentation)
Is there a way to specify active profiles that would apply to a single module or module instance only?
Upvotes: 1
Views: 284
Reputation: 2284
You need to use a POJO to define your module options (ie any placeholders you have in your spring config for the module) instead of the 'simple' approach of a properties file that defines your options in the config folder of your module. Once you have have your options POJO in addition to resolving the placeholders you can implement the ProfileNamesProvider interface and in the profilesToActivate() method you can return profiles to activate for a particular module definition (instance). The profiles returned can be worked out depending on the options supplied by the user in the POJO's setter methods.
See http://docs.spring.io/spring-xd/docs/1.0.3.RELEASE/reference/html/#_using_the_pojo_approach
Upvotes: 4