I have a generic java agent based on aspectj which runs on several spring boot applications (and several spring boot versions). I'm trying to find a way to get the port on runtime, programatically when the application STARTS (before a request is made). The problem -
I cannot use the regular way to get a spring boot port such as the ones described in https://stackoverflow.com/questions/30312058/spring-boot-how-to-get-the-running-port which includes @Autowired annotation etc.
I'm looking for the port after the applications starts, without relying on requests to be made.
I'm looking for a way to access the LocalServerPort object or any other options that will allow me to access the port.
thanks for any help