@@ -152,15 +152,16 @@ void testPasswordInUrlStartsWithColon() {
152152 @ Test
153153 void testRedisConfigurationWithPool () {
154154 this .contextRunner
155- .withPropertyValues ("spring.data.redis.host:foo" , "spring.data.redis.jedis.pool.min-idle:0 " ,
155+ .withPropertyValues ("spring.data.redis.host:foo" , "spring.data.redis.jedis.pool.min-idle:1 " ,
156156 "spring.data.redis.jedis.pool.max-idle:4" , "spring.data.redis.jedis.pool.max-active:16" ,
157157 "spring.data.redis.jedis.pool.max-wait:2000" ,
158158 "spring.data.redis.jedis.pool.time-between-eviction-runs:30000" )
159+ .withUserConfiguration (JedisDisableStartupConfiguration .class )
159160 .run ((context ) -> {
160161 JedisConnectionFactory cf = context .getBean (JedisConnectionFactory .class );
161162 assertThat (cf .getHostName ()).isEqualTo ("foo" );
162163 assertThat (cf .getPoolConfig ()).satisfies ((poolConfig ) -> {
163- assertThat (poolConfig .getMinIdle ()).isEqualTo ( 0 );
164+ assertThat (poolConfig .getMinIdle ()).isOne ( );
164165 assertThat (poolConfig .getMaxIdle ()).isEqualTo (4 );
165166 assertThat (poolConfig .getMaxTotal ()).isEqualTo (16 );
166167 assertThat (poolConfig .getMaxWaitDuration ()).isEqualTo (Duration .ofSeconds (2 ));
@@ -362,4 +363,25 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) {
362363
363364 }
364365
366+ @ Configuration (proxyBeanMethods = false )
367+ static class JedisDisableStartupConfiguration {
368+
369+ @ Bean
370+ static BeanPostProcessor jedisDisableStartup () {
371+ return new BeanPostProcessor () {
372+
373+ @ Override
374+ public Object postProcessBeforeInitialization (Object bean , String beanName ) {
375+ if (bean instanceof JedisConnectionFactory jedisConnectionFactory ) {
376+ jedisConnectionFactory .setEarlyStartup (false );
377+ jedisConnectionFactory .setAutoStartup (false );
378+ }
379+ return bean ;
380+ }
381+
382+ };
383+ }
384+
385+ }
386+
365387}
0 commit comments