-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Labels
Description
Due to the fact that the RedisEnhancedMappingContext is set as @primary, even when having your own RedisMappingContext like it is done in the unit test, it is not respected and a custom key space resolver is never used.
My config and bean which is never used.
`@Configuration
public class RedisKeyspaceConfig {
@Bean
public RedisMappingContext customKeyValueMappingContext(@Qualifier("redisEnhancedMappingContext") RedisMappingContext mappingContext,
RedisConfigProperties config,
Tenant tenant) {
mappingContext.setKeySpaceResolver(type -> RedisUtils.getKeyspace(type, config, tenant.getName()));
return mappingContext;
}
}`
Also this way it does not work:
`@Configuration
public class RedisKeyspaceConfig {
@Bean
public RedisMappingContext customKeyValueMappingContext(RedisConfigProperties config,
Tenant tenant) {
RedisEnhancedMappingContext mappingContext = new RedisEnhancedMappingContext();
mappingContext.setKeySpaceResolver(type -> RedisUtils.getKeyspace(type, config, tenant.getName()));
return mappingContext;
}
}`