I'm trying to add authorization to several microservices. Given all the services share similar authorization process, I want to extract the logic to a shared library.
I managed to create library, but I realise all the configurations need to be set in the application.yml
file in the microservice which calls the library. I don't want to expose some of the configurations at service layer though.
After some searches, I found I could set @PropertySource("library.properties")
in my library's configuration class to force reading properties from the specified .properties
file within the library.
The problem now is I want to set different values for different environments, e.g. authorization URL for test and production would be different. How can I configure the file so that the configuration class would read same property value based on active profile (e.g. environment = test/staging/production)?