Home > Mobile >  Spring mutlitple non-prod envionrment property
Spring mutlitple non-prod envionrment property

Time:06-22

My Spring Rest service will be invoked from API gateway which sends an environment property. Based on the environment property I need to invoke a different endpoint by reading from property files.

Example: my environment variable can be qa01, qa02, qa03 and so on. my calling endpoint would be https://hostname-qa01.intra.net or https://hostname-qa02.intra.net, https://hostname-qa03.intra.net etc.

This code is only specific for non-prod and prod the same code should work and prod has only endpoint https://hostname.intra.net

I know this can be achieved by a simple if check in Java but i'm looking for a elegant approach to my problem.

CodePudding user response:

Simplicity is a key design principle.

So go with simplicity. Try to focus more on finding the simple solution for complex problems than the opposite. Follow KISS, more suitable for your use-case.

https://en.wikipedia.org/wiki/KISS_principle

  • Related