How to Expose a REST API on a Different Port in Spring Boot Without Causing a PortInUseException?
I’m trying to expose a separate REST API in my Spring Boot application, bound to a different port from the default server and management ports. To achieve this, I created a new TomcatServletWebServerFactory and bound the new port to the container. I also set up a new GenericWebApplicationContext and linked my REST controller to this context.