I am using Spring Boot 3.3.5 and I create custom contexts by overriding tomcatFactory.
As all our custom contexts share similar behavior (same REST Controller, same behavior) and is only differentiated by their Context Path to help us differentiate which custom Data Source to access, is it OK for all the web contexts to use the same AnnotationConfigWebApplicationContext
and DispatcherServlet
?
My only concern is the AnnotationConfigWebApplicationContext.setServletContext
which is required by some Spring Boot web autoconfiguration, and I only call this once by setting the ServletContext of the first custom Context created.