How to obtain PID pf a SpringBoot application
I apologize if this is a duplicate or a continuation of other threads, but unfortunately after sifting through tons of posts I came back empty handed.
As I mentioned in a comment to another post, I came up with a partial solution (or more like a workaround) to obtain a PID of a process being debugged. However, since I need to support pretty much any Maven or Gradle-based configuration, I ran into a problem where the application is actually a SpringBoot app launched using Maven command, e.g. `mvn spring-boot:run`. In this case SpringBoot forks the Java process, so the process I can obtain is the PID of the launcher, not the actual Java / SpringBoot app. So I'm wondering if there's any better way to do it. The Ultimate version of IDEA supports SpringBoot, so it must be possible. Any thoughts?
Please sign in to leave a comment.
com.intellij.debugger.impl.attach.JavaDebuggerAttachUtil#getAttachedPids might be a starting point