I am working with a Java Springboot (2.1.2) application in VSCode. I have the debugger working and can run the application. However, I am having difficulty adding Spring specific arguments to the run command. I have looked around alot but can't seem to find anything on this.
I am trying to tell spring to use two application.yml files. The code I would use in the command line to actually run the application is:
mvn spring-boot:run \
-Dspring.config.location=classpath:/application.yml,classpath:/application-secret.yml
I want to be able to add this argument to the vscode launch.json file.
My current launch file looks like this, but I have tried alot of different variations.
{"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Blog Rest",
"request": "launch",
"mainClass": "com.example.BlogRestApplication",
"args": [
"-Dspring.config.location=classpath:/application.yml,classpath:/application-secret.yml"
]
}
]}
I actually just figured it out. I thought I had tried this before, but I guess not. I had to change it from args
to vmArgs
.
Updated file:
{"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Blog Rest",
"request": "launch",
"mainClass": "com.example.BlogRestApplication",
"vmArgs": [
"-Dspring.config.location=classpath:/application.yml,classpath:/application-secret.yml"
]
}
]}
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