spring-projects / spring-projects/spring-session

RedisIndexedSessionRepository resolveDatabase method not support redisson client

Open
#3,331 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: bug
Dominant language
Java
Stars
1.9k
Forks
1.2k
Avg merge
4h 27m
Merged PRs (30d)
55

Description

Describe the bug
"The RedisIndexedSessionRepository has a method called resolveDatabase() that retrieves the Redis database currently in use. However, when using Redisson, it always returns DEFAULT_DATABASE. This is because Redisson implements a different RedisConnectionFactory named org.redisson.spring.data.connection.RedissonConnectionFactory

	private int resolveDatabase() {
		if (ClassUtils.isPresent("io.lettuce.core.RedisClient", null)
				&& getRedisConnectionFactory() instanceof LettuceConnectionFactory) {
			return ((LettuceConnectionFactory) getRedisConnectionFactory()).getDatabase();
		}
		if (ClassUtils.isPresent("redis.clients.jedis.Jedis", null)
				&& getRedisConnectionFactory() instanceof JedisConnectionFactory) {
			return ((JedisConnectionFactory) getRedisConnectionFactory()).getDatabase();
		}
		return RedisIndexedSessionRepository.DEFAULT_DATABASE;
	}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in RedisIndexedSessionRepository.resolveDatabase() and inspect how the repository identifies LettuceConnectionFactory and JedisConnectionFactory. Compare that logic with RedissonConnectionFactory and verify that the configured Redis database is returned instead of DEFAULT_DATABASE; add or update coverage if the surrounding tests expose this method's behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.