Skip to content

troubles using more than one SpringVaadinServlet with different contextConfiguration #39

Description

@maslovalex

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.

public class SpringApplicationContext implements Serializable
{
    private static transient ApplicationContext applicationContext;

    public static void setApplicationContext(ApplicationContext applicationContext)
    {
        SpringApplicationContext.applicationContext = applicationContext;
    }

    public static ApplicationContext getApplicationContext()
    {
        return applicationContext;
    }
}

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions