There are two Application Contexts in Spring MVC apps

The root context, normally seen as biz-layer context, is normally defined as "applicationContext.xml" and loaded by ContextLoaderListener. 

The other context, the web-layer one is normally defined as "mvc-servlet.xml" and loaded by DispatcherServlet.

The web-layer context  will inherit beans from the root one, Except  some processors such as PropertyConfigurator. As a result, you should define two PropertyConfigurators. One for the biz layer, the other for the web layer.   See 

You may argue that your system has only one PropertyConfigurator and things work fine.  In this case, it’s highly possible your web-layer context is scanning biz-layer classes,  in addition to the web-layer classes.  As a result, your biz-layer spring beans have been loaded twice, one by the  ContextLoaderListener, the other by DispatcherServlet. 

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.