Open maslovalex opened 10 years ago
We ran into this issue during portlet development. Each portlet is required to specify it's own contextConfigLocation.
However because of the nature of ru.xpoft.vaadin.SpringApplicationContext
, only one application context is registered for whole application.
One thought how to solve this is to use map of contexts instead. Keys could be servlet/portlet names as they are available in VaadinServletService and VaadinPortletService, e.g. ((VaadinServletService) VaadinService.getCurrent()).getServlet().getServletName()
.
@xpoft any plans to look into this? Because of time constraint on our project we will implement the fix locally.
If I define few SpringVaadinServlets in my war with different "contextConfiguration" only one of them works. I guess the reason is static nature of SpringApplicationContext.
It is set in SpringVaadinServlet/Portlet.init(...) and used later in different places.
But when you have more than one Servlet defined in web.xml, the applicationContext in SpringApplicationContext is overridden by the last initialized servlet.
As a result only one servlet gets correct ApplicationContext. Others have to use in too, and it means NoSuchBeanDefinitionException...
pure static evil :)