开发者

Regarding multiple dispatcher servlet in Spring

I have two dispatcher servlets in my application. I write database related config (sessionfactory etc.) in separate xml file. In each dispatcher servlet config file (abc-servlet.xml, xyz-servlet.xml) I import this common database file. I am wondering will Spring create two instances of sessionFactory or is it shared with both. Both application are working fine in my dev environmen开发者_StackOverflow中文版t. I am worried about production if this causes any memory related issues.


From DispatcherServlet doc:

A web application can define any number of DispatcherServlets. Each servlet will operate in its own namespace, loading its own application context with mappings, handlers, etc. Only the root application context as loaded by ContextLoaderListener, if any, will be shared.

So, you're sessionFactory will only be shared if it's defined in an app context loaded by the ContextLoaderListener, otherwise not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜