I tested this in VSCode-1.40.2 using Java-1.8.0_231-b11
You will need the following to launch launch.json:
https://code.visualstudio.com/docs/java/java-debugging
For STS development you can download from:
https://marketplace.visualstudio.com/items?itemName=Pivotal.vscode-boot-dev-pack
Here is my launch.json settings which I use to spawn two instances of a microservice I developed using VSCode.
Note how I am setting the server port in vmArgs to serve on 8000 & 8001
{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch-8000) - CurrencyExchangeServiceApplication",
"request": "launch",
"mainClass": "com.microservices.currencyexchangeservice.CurrencyExchangeServiceApplication",
"projectName": "currency-exchange-service",
"vmArgs": "-Dserver.port=8000"
},
{
"type": "java",
"name": "CodeLens (Launch-8001) - CurrencyExchangeServiceApplication",
"request": "launch",
"mainClass": "com.microservices.currencyexchangeservice.CurrencyExchangeServiceApplication",
"projectName": "currency-exchange-service",
"vmArgs": "-Dserver.port=8001"
}
]
}
You will end up with two configurations in your editor like so:
Hope this helps.