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

RedisIndexedSessionRepository resolveDatabase method not support redisson client #3331

Open
gabrielsky opened this issue Jan 23, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged type: bug A general bug

Comments

@gabrielsky
Copy link

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;
	}
@gabrielsky gabrielsky added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jan 23, 2025
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 type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant