spring-projects / spring-projects/spring-session
DestructionCallbackBindingListener on SessionScoped Beans not called
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Description
When a @SessionScope bean contains a method annotated with @PreDestroy, the method is not called when using either JdkSerializationRedisSerializer or GenericJackson2JsonRedisSerializer.
Behavior with different serializers:
-
JdkSerializationRedisSerializer:
The@PreDestroymethod is not called, but no errors occur. -
GenericJackson2JsonRedisSerializer:
ASerializationExceptionis thrown byorg.springframework.data.redis.serializer.
To Reproduce
A @SessionScope bean with a method annotated with @PreDestroy is present and in use.
Expected Behavior
The method annotated with @PreDestroy should be invoked when the bean is destroyed, regardless of the serializer used.
Sample
Sample project using Spring Boot 3.5.0
See also: Issue #1256
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked sample project using Spring Boot 3.5.0 and reproduce destruction of a @SessionScope bean with @PreDestroy using each named serializer. Inspect the resulting SerializationException and verify that the callback is invoked for both JdkSerializationRedisSerializer and GenericJackson2JsonRedisSerializer when the issue is fixed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring-boot
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100