eclipse-ee4j / eclipse-ee4j/jersey

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

Open
#3,601 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

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

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

if (sc != null) {
// servlet container
ctx = WebApplicationContextUtils.getWebApplicationContext(sc);
} else {
// non-servlet container
ctx = createSpringContext();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.