eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
690 stars 352 forks source link

SpringComponentProvider is dependent on ServletContext which doesn't exist in non-servlet container case #3601

Open jerseyrobot opened 7 years ago

jerseyrobot commented 7 years ago

SpringComponentProvider is dependent on ServletContext which doesn't exist in non-servlet container case. So it will cause ClassNotFoundException in non-servlet container case where ServletContext.class can not be found.

The related code in SpringComponentProvider.initialize

        ServletContext sc = locator.getService(ServletContext.class);

        if (sc != null) {
            // servlet container
            ctx = WebApplicationContextUtils.getWebApplicationContext(sc);
        } else {
            // non-servlet container
            ctx = createSpringContext();
        }
jerseyrobot commented 6 years ago