How to locate a spring defined bean in another portlet

I have a spring bean defined in a Spring Portlet A. My question is how to use portlet bean locator to locate this bean in another Portlet B. Is it possible, cause the below line didn't work for me.

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

PS: i declare the ContextLoaderListener in Portlet A web.xml and use a contextConfigLocation to set which context file to load, and this bean is defined in the context file.


I was exploring the same thing yesterday and here is my understanding (if that helps in anyway).

Beans loaded through the ContextLoaderListener are not available for PortletBeanLocatorUtil except the Service Builder generated beans.

链接地址: http://www.djcxy.com/p/82036.html

上一篇: 在没有应用程序服务器重启或运行时初始化spring bean

下一篇: 如何在另一个portlet中定位一个spring定义的bean