Skip to content

DestructionCallbackBindingListener on SessionScoped Beans not called #3415

Open

Description

@thaarbach

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 @PreDestroy method is not called, but no errors occur.

  • GenericJackson2JsonRedisSerializer:
    A SerializationException is thrown by org.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions