最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - In Spring Boot Web, Is it safe to share AnnotationConfigWebApplicationContext between multiple Web Contexts - Stack Overf

programmeradmin5浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论