You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let me start by saying I realize spring 5+ / spring-boot 2+ are documented as requiring Java EE 7 / Servlet 3.1+. With that said, in practice we have been successfully running on a servlet 3.0 environment until this change: #24879 (our use case is similar to this comment: #24879 (comment))
I would like to open a PR with a change like this:
diff --git "a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java" "b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java"
index f8f7896334..c970f949be 100644
--- "a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java"
+++ "b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletListenerRegistrationBean.java"
@@ -57,6 +57,9 @@ import org.springframework.util.ClassUtils;
*/
public class ServletListenerRegistrationBean<T extends EventListener> extends RegistrationBean {
+ private static boolean servlet31 = ClassUtils.isPresent("javax.servlet.http.HttpSessionIdListener",
+ ServletListenerRegistrationBean.class.getClassLoader());
+
private static final Set<Class<?>> SUPPORTED_TYPES;
static {
@@ -65,9 +68,11 @@ public class ServletListenerRegistrationBean<T extends EventListener> extends Re
types.add(ServletRequestListener.class);
types.add(ServletRequestAttributeListener.class);
types.add(HttpSessionAttributeListener.class);
- types.add(HttpSessionIdListener.class);
types.add(HttpSessionListener.class);
types.add(ServletContextListener.class);
+ if (servlet31) {
+ types.add(HttpSessionIdListener.class);
+ }
SUPPORTED_TYPES = Collections.unmodifiableSet(types);
}
(If I open a PR I'll include a test also).
However, before taking the time, I would like to understand if such a change has a chance of being merged. Having this change available in future spring-boot 2.6.x and 2.7.x versions would be useful for us (and perhaps others also), but I understand if this is something you would not accept due to documented requirements.
Please let me know your thoughts, and thanks in advance for your time.
The text was updated successfully, but these errors were encountered:
Sorry, but this isn't a change that we will make. We've required Servlet 3.1 since 2.0 and Framework has required it since 5.0. Even if we made the change that you are suggesting, you'd still be using an unsupported arrangement as Framework would still require Servlet 3.1.
Let me start by saying I realize spring 5+ / spring-boot 2+ are documented as requiring Java EE 7 / Servlet 3.1+. With that said, in practice we have been successfully running on a servlet 3.0 environment until this change: #24879 (our use case is similar to this comment: #24879 (comment))
I would like to open a PR with a change like this:
(If I open a PR I'll include a test also).
However, before taking the time, I would like to understand if such a change has a chance of being merged. Having this change available in future spring-boot 2.6.x and 2.7.x versions would be useful for us (and perhaps others also), but I understand if this is something you would not accept due to documented requirements.
Please let me know your thoughts, and thanks in advance for your time.
The text was updated successfully, but these errors were encountered: