I got an spring boot app with the following application.properties
setting.
#...
spring.datasource.url=${JDBC_DATABASE_URL}
When I use an IDE like IntelliJ I can set the environment variable and it woks when I start the app.
But now I want to start my app over the console with maven mvn spring-boot:run
. How can I set the environment variable here?
From spring-boot version 2 argline key run.jvmArguments
replaced for spring-boot.run.jvmArguments
: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#run-example-debug . So correct command is:
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-DJDBC_DATABASE_URL=jdbc:..."
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