@@ -152,15 +152,16 @@ void testPasswordInUrlStartsWithColon() {
152
152
@ Test
153
153
void testRedisConfigurationWithPool () {
154
154
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 " ,
156
156
"spring.data.redis.jedis.pool.max-idle:4" , "spring.data.redis.jedis.pool.max-active:16" ,
157
157
"spring.data.redis.jedis.pool.max-wait:2000" ,
158
158
"spring.data.redis.jedis.pool.time-between-eviction-runs:30000" )
159
+ .withUserConfiguration (JedisDisableStartupConfiguration .class )
159
160
.run ((context ) -> {
160
161
JedisConnectionFactory cf = context .getBean (JedisConnectionFactory .class );
161
162
assertThat (cf .getHostName ()).isEqualTo ("foo" );
162
163
assertThat (cf .getPoolConfig ()).satisfies ((poolConfig ) -> {
163
- assertThat (poolConfig .getMinIdle ()).isEqualTo ( 0 );
164
+ assertThat (poolConfig .getMinIdle ()).isOne ( );
164
165
assertThat (poolConfig .getMaxIdle ()).isEqualTo (4 );
165
166
assertThat (poolConfig .getMaxTotal ()).isEqualTo (16 );
166
167
assertThat (poolConfig .getMaxWaitDuration ()).isEqualTo (Duration .ofSeconds (2 ));
@@ -362,4 +363,25 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) {
362
363
363
364
}
364
365
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
+
365
387
}
0 commit comments