【问题标题】:How to locate a spring defined bean in another portlet如何在另一个 portlet 中定位 spring 定义的 bean
【发布时间】:2014-07-11 10:47:25
【问题描述】:

我在 Spring Portlet A 中定义了一个 spring bean。我的问题是如何使用 portlet bean 定位器在另一个 Portlet B 中定位这个 bean。是否可能,因为下面的行对我不起作用。

MyBean myBean = (MyBean)PortletBeanLocatorUtil.locate("PortletA-portlet", MyBean.class.getName());

PS:我在 Portlet A web.xml 中声明了 ContextLoaderListener 并使用 contextConfigLocation 来设置要加载的上下文文件,而这个 bean 是在上下文文件中定义的。

【问题讨论】:

    标签: spring liferay


    【解决方案1】:

    我昨天也在探索同样的事情,这是我的理解(如果这有帮助的话)。

    通过 ContextLoaderListener 加载的 Bean 不可用于 PortletBeanLocatorUtil,除了 Service Builder 生成的 bean。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-24
      • 2011-01-25
      • 1970-01-01
      • 2020-01-25
      • 2013-04-09
      • 2022-06-17
      • 1970-01-01
      相关资源
      最近更新 更多