Reputation: 31
It is possible to access a portlet context bean from root application context in spring mvc portlet?
Upvotes: 1
Views: 1521
Reputation: 7522
If publishContext
property of DispatcherPortlet
is true (default value) then you can get portlet appcontext from javax.portlet.PortletContext
as:
ApplicationContext otherPortletContext = portletContext.getAttribute(FrameworkPortlet.PORTLET_CONTEXT_PREFIX + otherPortletName);
then use bean of other portlet Context as:
portletBean = otherPortletContext.getBean(beanName, beanClass);
Note that you can get javax.portlet.PortletContext
object by implementing PortletContextAware
.
Upvotes: 1
Reputation: 403481
No, you cannot reach "down" like that. Portlet/servlet beans can see beans in the root context, but not the other way around.
Upvotes: 0