Reputation: 409
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?
Upvotes: 3
Views: 1359
Reputation: 99
I had the same issue, but I had all the configuration correctly and still wasn't working. It even worked in the past. So, eventually the solution to make it work again was a simple clean + package of the project.
Upvotes: 0
Reputation: 116281
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);
}
Upvotes: 3