0

I have application.yml

spring.active.profile=default,dev
api-url: http://dev-api.com

I have another file application-mock.yml which has below api-url related to wiremock.

 application-mock.yml
         api-url: http://localhost:7845

I have requirement to provide the developer/tester to use mock api-url or real api url from test environment based on their needs. We have central puppet configuration file test.yml which has below content which will call real api properly and it works as expected currently.

test.yml
    spring.active.profile=default,test
    api-url: http://test-api.com

Now, i need to provide the option to use mock-api url from test envionment. I cant edit api-url in test.yaml in puppet configuration to point to http://localhost:7845 because it affect functionality on calling real api.

I want to make real api and mock api also should work based on developer/tester needs instead of changing or committing test.yml.

my spring java service contains value annotation for api-url to retrieve url.

Kindly provide me your valuable input.

user2057006
  • 617
  • 4
  • 15
  • 28
  • Is it OK if you restart the app ? I mean, changing your profile on the fly without reloading the context might me really hard. – sashok_bg May 02 '17 at 16:12
  • If its not possible on the fly, how to achieve if restart the app? pls suggest – user2057006 May 02 '17 at 16:46
  • You can specify the currently active profile via command line argument. Just start your application with -Dspring.profiles.active=test – sashok_bg May 03 '17 at 07:16

0 Answers0