0

I am building an API using Spring Boot 2 (using Spring MVC) and it exposes endpoints such as /users under the context path of /api and a port of 8080. So I can access this by hitting http://localhost:8080/api/users.

Now I would like to expose a separate set of auxiliary endpoints (similar to how Spring Boot actuator does) on a different port and context path. These endpoints would be implemented using Spring MVC as well. So for example, I expect a response when I hit http://localhost:9090/meta/status where /meta is the context path.

I've tried various approaches so far with not much success such as creating a separate dispatcher servlet, providing my own WebServerFactoryCustomizer to adding a new Tomcat connector. All these approaches either override the original application's context path and port or do not recognise my meta endpoints at all.

If I could get some pointers on how to do this using Spring Boot 2 using purely Java config, it would help me a lot. Thanks.

adarshr
  • 61,315
  • 23
  • 138
  • 167
  • If I understood correctly you are looking similar to [this](https://stackoverflow.com/questions/21630820/configure-multiple-servletcontainers-servlets-with-spring-boot) and [this](https://stackoverflow.com/questions/29096511/using-multiple-dispatcher-servlets-web-contexts-with-spring-boot) – mallikarjun Jul 11 '18 at 13:27
  • @mallikarjun that looks like what I'm trying to do but unfortunately that example is from 3 years old and that class no longer exists on Spring Boot GitHub repo. – adarshr Jul 11 '18 at 13:37

0 Answers0