Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-configuration's session repository customization may override that of SessionRepositoryCustomizer beans #36674

Closed
ashitikov-bld opened this issue Aug 2, 2023 · 4 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@ashitikov-bld
Copy link

ashitikov-bld commented Aug 2, 2023

Hi,
It seems there's missed @Order(Ordered.HIGHEST_PRECEDENCE) on springBootSessionRepositoryCustomizer in RedisSessionConfiguration.IndexedRedisSessionConfiguration. The default customizer is always applied after my custom one and I cannot control this over @Order annotation on my bean.
Spring Boot 3.1.2.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 2, 2023
@wilkinsona
Copy link
Member

I think we could order it at 0 but that would be a potentially breaking change so it couldn't be done in a maintenance release.

Given that springBootSessionRepositoryCustomizer only applies values from configuration properties, I'm curious to know why you're also trying to configure those values using a SessionRepositoryCustomizer. Why not use configuration properties instead?

@wilkinsona wilkinsona changed the title Default SessionRepositoryCustomizer overrides values from a custom one Order default session repository customisers at 0 so that user-defined customisers can override them Aug 2, 2023
@wilkinsona wilkinsona changed the title Order default session repository customisers at 0 so that user-defined customisers can override them Order default session repository customizers at 0 so that user-defined customizers can override them Aug 2, 2023
@wilkinsona wilkinsona added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 2, 2023
@wilkinsona wilkinsona added this to the 3.2.x milestone Aug 2, 2023
@ashitikov-bld
Copy link
Author

I've already rewritten to configuration properties.
Hovewer there can be a case when you need to set namespace or smth depending on some condition.

@wilkinsona wilkinsona self-assigned this Aug 2, 2023
@wilkinsona
Copy link
Member

wilkinsona commented Aug 2, 2023

I've just noticed that Boot's SessionRepositoryCustomizer<JdbcIndexedSessionRepository> is @Order(Ordered.HIGHEST_PRECEDENCE). This came from #33514 which fixed a regression, restoring in 3.0.x the behaviour that we had in 2.7.x. It looks like that same regression applies to the other session stores as well as they all moved from the customizer approach at the same time in #32554.

In light of the above, I've changed my mind. I think we should fix this in 3.0.x and later. The order should be Ordered.HIGHEST_PRECEDENCE as this aligns things most closely with how they worked in 2.7..

@wilkinsona wilkinsona changed the title Order default session repository customizers at 0 so that user-defined customizers can override them Auto-configuration's session repository customization may override that of SessionRepositoryCustomizer beans Aug 2, 2023
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed type: enhancement A general enhancement labels Aug 2, 2023
@wilkinsona wilkinsona modified the milestones: 3.2.x, 3.0.x Aug 2, 2023
@quaff
Copy link
Contributor

quaff commented Aug 3, 2023

We should review Customizer in other *Configuration not only SessionConfiguration, discuss whether Ordered.HIGHEST_PRECEDENCE or 0 is more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

4 participants