Skip to content

Migrate JdbcTokenRepositoryImpl to JdbcPersistentTokenRepository#19163

Open
therepanic wants to merge 1 commit into
spring-projects:mainfrom
therepanic:gh-18987
Open

Migrate JdbcTokenRepositoryImpl to JdbcPersistentTokenRepository#19163
therepanic wants to merge 1 commit into
spring-projects:mainfrom
therepanic:gh-18987

Conversation

@therepanic
Copy link
Copy Markdown
Contributor

@therepanic therepanic commented May 9, 2026

Since JdbcDaoSupport has been deprecated, we should deprecate our implementation of JdbcTokenRepositoryImpl, which directly inherits from JdbcDaoSupport. Instead of using JdbcDaoSupport, we are advised to inject JdbcTemplate or JdbcClient into the field, so we should create a new implementation of JdbcPersistentTokenRepository.

References: gh-18982
Closes: gh-18987
Closes: gh-18986

Since `JdbcDaoSupport` has been deprecated, we should deprecate our
implementation of `JdbcTokenRepositoryImpl`, which directly inherits
from `JdbcDaoSupport`. Instead of using `JdbcDaoSupport`, we are advised
to inject `JdbcTemplate` or `JdbcClient` into the field, so we should
create a new implementation of `JdbcPersistentTokenRepository`.

References: spring-projectsgh-18982
Closes: spring-projectsgh-18987, spring-projectsgh-18986

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
Comment on lines +69 to +85

private final JdbcClient jdbcClient;

protected final Log logger = LogFactory.getLog(this.getClass());

public JdbcPersistentTokenRepository(JdbcClient jdbcClient) {
this.jdbcClient = jdbcClient;
}

public JdbcPersistentTokenRepository(DataSource dataSource) {
this.jdbcClient = JdbcClient.create(dataSource);
}

public JdbcPersistentTokenRepository(JdbcTemplate jdbcTemplate) {
this.jdbcClient = JdbcClient.create(jdbcTemplate);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great opportunity for us to start using the new JdbcClient API, which is fully compatible with the existing JdbcClient. Nice!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 9, 2026
Comment on lines +39 to 41
@Deprecated(since = "7.1.0")
@SuppressWarnings("removal")
public class JdbcTokenRepositoryImpl extends JdbcDaoSupport implements PersistentTokenRepository {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mark it as "forRemoval" because otherwise the build would fail.

@therepanic
Copy link
Copy Markdown
Contributor Author

I don't think the 8.0.0 branch is available yet to remove JdbcTokenRepositoryImpl. In any case, aside from that, we'll need to use our new implementation by default in RememberMeBeanDefinitionParser#parse instead of the removed JdbcTokenRepositoryImpl.

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

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add JdbcPersistentTokenRepository Deprecate JdbcTokenRepositoryImpl

2 participants