7474 * <li>{@link RedisClusterConfiguration}</li>
7575 * </ul>
7676 * <p>
77- * This connection factory must be {@link #afterPropertiesSet() initialized} and {@link SmartLifecycle#start() started}
78- * prior to {@link #getConnection obtaining connections}. You can {@link SmartLifecycle#stop()} and
79- * {@link SmartLifecycle#start() restart} this connection factory if needed.
77+ * This connection factory implements {@link InitializingBean} and {@link SmartLifecycle} for flexible lifecycle
78+ * control. It must be {@link #afterPropertiesSet() initialized} and {@link #start() started} before you can obtain a
79+ * connection. {@link #afterPropertiesSet() Initialization} {@link SmartLifecycle#start() starts} this bean
80+ * {@link #isAutoStartup() by default}. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() restart}
81+ * this connection factory if needed.
8082 *
8183 * @author Costin Leau
8284 * @author Thomas Darimont
@@ -96,12 +98,15 @@ public class JedisConnectionFactory
9698
9799 private final JedisClientConfiguration clientConfiguration ;
98100
99- private boolean convertPipelineAndTxResults = true ;
100101 private RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration ("localhost" ,
101102 Protocol .DEFAULT_PORT );
102103
103104 private @ Nullable RedisConfiguration configuration ;
104105
106+ private int phase = 0 ; // in between min and max values
107+
108+ private boolean convertPipelineAndTxResults = true ;
109+
105110 /**
106111 * Lifecycle state of this factory.
107112 */
@@ -118,8 +123,6 @@ enum State {
118123 private @ Nullable ClusterTopologyProvider topologyProvider ;
119124 private @ Nullable ClusterCommandExecutor clusterCommandExecutor ;
120125
121- private int phase = DEFAULT_PHASE - 10 ;
122-
123126 /**
124127 * Constructs a new {@link JedisConnectionFactory} instance with default settings (default connection pooling).
125128 */
@@ -266,7 +269,8 @@ public JedisConnectionFactory(RedisClusterConfiguration clusterConfig, JedisClie
266269 public void afterPropertiesSet () {
267270
268271 clientConfig = createClientConfig (getDatabase (), getRedisUsername (), getRedisPassword ());
269- if (isAutoStartup ()) {
272+
273+ if (isAutoStartup ()) {
270274 start ();
271275 }
272276 }
@@ -368,6 +372,21 @@ public void stop() {
368372 }
369373 }
370374
375+ @ Override
376+ public int getPhase () {
377+ return phase ;
378+ }
379+
380+ /**
381+ * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}.
382+ *
383+ * @since 3.2
384+ * @see SmartLifecycle#getPhase()
385+ */
386+ public void setPhase (int phase ) {
387+ this .phase = phase ;
388+ }
389+
371390 @ Override
372391 public boolean isRunning () {
373392 return State .STARTED .equals (state .get ());
@@ -859,21 +878,6 @@ public boolean isRedisClusterAware() {
859878 return RedisConfiguration .isClusterConfiguration (configuration );
860879 }
861880
862- @ Override
863- public int getPhase () {
864- return phase ;
865- }
866-
867- /**
868- * Specify the lifecycle phase for pausing and resuming this executor.
869- * The default is {@link #DEFAULT_PHASE} - 10.
870- * @since 3.2
871- * @see SmartLifecycle#getPhase()
872- */
873- public void setPhase (int phase ) {
874- this .phase = phase ;
875- }
876-
877881 @ Override
878882 public RedisSentinelConnection getSentinelConnection () {
879883
0 commit comments