将Spring Root application-context.xml放在多模块应用程序中的位置?

时间:2013-12-09 17:49:31

标签: spring spring-mvc

我的网络应用程序有2个模块:

  • 核心(服务,存储库/ dao,实体等)
  • web(视图,控制器,转换器,过滤器等)

Web模块具有带有Spring MVC定义的dispatcher-context.xml。

我很困惑将Spring Root Application Context(application-context.xml)与Data / JTA定义 - Web模块或Core模块放在何处?

提前致谢!

1 个答案:

答案 0 :(得分:1)

根应用程序上下文旨在包含应该可供最终应用程序中的每个组件使用的bean。 servlet应用程序上下文旨在包含仅应对DispatcherServlet堆栈可用的bean。 This question and its answer explain how Spring manages them.

Core应包含根应用程序上下文,因为它声明了整个应用程序可用的服务,存储库和实体。