spring-projects / spring-projects/spring-session

Possible to Disable Spring Session Without Compiling?

Open
#1,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
1.9k
Forks
1.2k
Avg merge
4h 27m
Merged PRs (30d)
55

Description

Hi, I'm implementing Spring Session/Spring Data Redis in an application that will be deployed in environments that may or may not have a Redis repository configured, and therefore in the latter case the standard HttpSession functionality provided by the web server should be used instead.

I'm using a Java-based Spring Session configuration for the implementation, which includes creating an Initializer subclass that inherits AbstractHttpSessionApplicationInitializer, which itself is an implementation of WebApplicationInitializer. This means my Spring Session Initializer class will always be executed upon application deployment, which is not always desirable in my use case.

Is there some way to disable Spring Session that can be toggled via something external to the application (i.e. an environment property, etc)? I tried using the Spring @Conditional mechanism on the Initializer class, but this does not work as the annotation is not acknowledged when applied to subclasses.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Java-based Initializer subclass and AbstractHttpSessionApplicationInitializer, including how WebApplicationInitializer classes are discovered and run. Determine whether an external setting can prevent Spring Session initialization while preserving standard HttpSession behavior; done requires an agreed design and documented configuration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.