Remove redundant restart-compatible Redis serializer
Previously, Spring Data Redis assumed that the class loader that loaded its classes would also be able to load the application’s classes. This assumption is faulty when there are multiple class loaders involved such as when using dev tools or when Spring Data Redis is installed as a shared library in a servlet container. DATAREDIS-427 and DATAREDIS-501 removed this assumption by making the default serialiser use the bean class loader. DevTools configures this class loader to be the restart class loader which can load the application’s classes. As a result of moving to Hopper SR2 snapshots, these fixes are now available and we can remove our custom serialised. Closes gh-5760
This commit is contained in:
@@ -31,7 +31,6 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||
import org.springframework.boot.devtools.autoconfigure.RestartCompatibleRedisSerializerConfigurer.RestartCompatibleRedisSerializer;
|
||||
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
|
||||
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
|
||||
import org.springframework.boot.devtools.filewatch.ChangedFiles;
|
||||
@@ -235,31 +234,6 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||
.containsKey(new File("src/test/java").getAbsoluteFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sessionRedisTemplateIsConfiguredWithCustomDeserializers()
|
||||
throws Exception {
|
||||
sessionRedisTemplateIsConfiguredWithCustomDeserializers(
|
||||
SessionRedisTemplateConfig.class);
|
||||
}
|
||||
|
||||
private void sessionRedisTemplateIsConfiguredWithCustomDeserializers(
|
||||
Object sessionConfig) throws Exception {
|
||||
SpringApplication application = new SpringApplication(sessionConfig,
|
||||
LocalDevToolsAutoConfiguration.class);
|
||||
application.setWebEnvironment(false);
|
||||
this.context = application.run();
|
||||
RedisTemplate<?, ?> redisTemplate = this.context.getBean("sessionRedisTemplate",
|
||||
RedisTemplate.class);
|
||||
assertThat(redisTemplate.getHashKeySerializer())
|
||||
.isInstanceOf(RestartCompatibleRedisSerializer.class);
|
||||
assertThat(redisTemplate.getHashValueSerializer())
|
||||
.isInstanceOf(RestartCompatibleRedisSerializer.class);
|
||||
assertThat(redisTemplate.getKeySerializer())
|
||||
.isInstanceOf(RestartCompatibleRedisSerializer.class);
|
||||
assertThat(redisTemplate.getValueSerializer())
|
||||
.isInstanceOf(RestartCompatibleRedisSerializer.class);
|
||||
}
|
||||
|
||||
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
|
||||
String... args) {
|
||||
return initializeAndRun(config, Collections.<String, Object>emptyMap(), args);
|
||||
|
||||
Reference in New Issue
Block a user