Setting active profile and config location from command line in spring boot

To set the active profile and the configuration location from the command line in Spring Boot, you can use the spring.profiles.active and spring.config.name properties.

Here's an example of how you can set these properties when running a Spring Boot application:

java -jar myapp.jar --spring.profiles.active=prod --spring.config.name=application-prod

You can also set these properties using environment variables or by using the spring.config.additional-location property to specify additional configuration locations.

For example:

java -jar myapp.jar --spring.config.additional-location=file:/etc/myapp/application-prod.properties