Check this link from SAP Learning: https://learning.sap.com/learning-journeys/develop-advanced-extensions-with-sap-cloud-sdk/exercise-debugging-a-spring-boot-application-in-cloud-foundry_c2d2b14c-7652-42b8-8a88-531d5c42fdcc
Basically you must create or update your launch.json file with the following content:
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Application",
"request": "launch",
"mainClass": "com.example.demo.DemoApplication",
"projectName": "demo"
},
{
"type": "java",
"name": "Attach Application",
"request": "attach",
"hostName": "localhost",
"port": 5005,
"sourcePaths": [ "${workspaceFolder}" ]
}
]
}
And then execute the follogin commands in terminal:
cf set-env my-spring-demo JBP_CONFIG_JAVA_OPTS "[java_opts: '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000']"
cf enable-ssh my-spring-demo
cf restage my-spring-demo
cf ssh -N -T -L 5005:localhost:8000 my-spring-demo