I've written a Spring Boot Application. I'm running the jar, while running the jar I'm overriding the property file keys for e.g: java -jar example.jar --spring.profiles.active=test, but the key is not overriding. What could be the reason for this?
For command line arguments to override properties, you need to pass the arguments from your application's main method into SpringApplication.run.
Your main method should look something like this:
public static void main(String[] args) throws Exception {
SpringApplication.run(YourApplication.class, args);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With