【问题标题】:How to use same context for multiple WARs?如何为多个 WAR 使用相同的上下文?
【发布时间】:2015-07-27 10:56:49
【问题描述】:

我按照link 中的示例使用 SingletonBeanFactoryLocator 在两个 WAR 中使用相同的 bean,但似乎创建的两个 bean 不是单个的。

我通过点击http://localhost:8080/War1/http://localhost:8080/War2/ 进入下方

使用服务实例 com.interface21.sample.multiplecontexts.service 来自 SampleWeb1 的问候。SampleServiceImpl@5cfbe4c4

使用服务实例 com.interface21.sample.multiplecontexts.service 来自 SampleWeb2 的问候。SampleServiceImpl@efa0fed

https://github.com/manojp1988/Learning/tree/JavaDSL/SingletonBeanFactoryLocatorEx

你能帮我看看我做错了什么吗?

【问题讨论】:

    标签: spring spring-web


    【解决方案1】:

    我找到了答案,因为战争有单独的罐子副本,没有加载相同的 bean。一旦我将战争剥皮以使用相同的弹簧罐副本,我发现它起作用了。 Spring MVC: Sharing context within ear

    【讨论】:

      猜你喜欢
      • 2012-04-28
      • 1970-01-01
      • 2011-02-01
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      相关资源
      最近更新 更多