Why RedisIndexedHttpSessionConfiguration register ApplicationEventPublisher bean by setter injection?
brido4125 opened this issue · comments
Expected Behavior
If the ApplicationEventPublisher
instance doesn't change its reference after the spring container is started, I think it's better to register it as a bean by constructor injection from an encapsulation point of view.
Current Behavior
The current implementation uses setter injection to inject beans.
Context
Do this by creating a constructor that takes an ApplicationEventPublisher
as an parameter and deleting the setter method that currently exists.
This affects the setCustomFlushImmediately
test case in the RedisIndexedHttpSessionConfigurationTests
class, but since the purpose of the test case is to check the FlushMode
value, it's probably okay to pass null
as an argument.
Thanks for the report.
The Spring security team (and thus Spring session team) use a setter for optional dependencies to avoid very large constructors.