Всем привет. Подскажите пожалуйста
у меня в spring boot есть redis
он работает как часы пока не доходит дело до тестов. В integration test он мне не нужен как его отрубить?
попытался отрубить так
в
application.properties spring.redis.host=localhost
spring.redis.port=6379
spring.redis.password=
spring.redis.timeout=60000
@Configuration@EnableRedisRepositories@ConditionalOnProperty(name = "testing", havingValue = "false", matchIfMissing = true)
public class RedisConfig extends AbstractHttpSessionApplicationInitializer {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
template.setEnableTransactionSupport(true);
template.afterPropertiesSet();
return template;
}
}
ну и в тесте пытаюсь так
@IntegrationTest@SpringBootTest(properties = "local.server.port=8080")
@TestPropertySource(properties = "testing=true")
@AutoConfigureMockMvcclass ServiceControllerTest {
и тест начинает ругаться
Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Host must not be empty