class LettuceFactory implements FactoryBean {
    @Autowired
    private AutoConfigureBeans autoConfigureBeans;

    private boolean inited;
    private Object obj;
    private Class<?> clazz;
    private String key;

    // for unit test
    LettuceFactory(AutoConfigureBeans autoConfigureBeans, String key, Class<?> clazz) {
        this(key, clazz);
        this.autoConfigureBeans = autoConfigureBeans;
    }


    public LettuceFactory(String key, Class<?> clazz) {
        this.clazz = clazz;
        if (AbstractRedisClient.class.isAssignableFrom(clazz)) {
            key += ".client";
        } else if (StatefulConnection.class.isAssignableFrom(clazz)) {
            key += ".connection";
        } else if (RedisClusterCommands.class.isAssignableFrom(clazz)) {
            // RedisCommands extends RedisClusterCommands
            key += ".commands";
        } else if (RedisClusterAsyncCommands.class.isAssignableFrom(clazz)) {
            // RedisAsyncCommands extends RedisClusterAsyncCommands
            key += ".asyncCommands";
        } else if (RedisClusterReactiveCommands.class.isAssignableFrom(clazz)) {
            // RedisReactiveCommands extends RedisClusterReactiveCommands
            key += ".reactiveCommands";
        } else {
            throw new IllegalArgumentException(clazz.getName());
        }
        this.key = key;
    }

    private void init() {<FILL_FUNCTION_BODY>}

    @Override
    public Object getObject() throws Exception {
        init();
        return obj;
    }

    @Override
    public Class<?> getObjectType() {
        return clazz;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}

        if (!inited) {
            obj = autoConfigureBeans.getCustomContainer().get(key);
            inited = true;
        }
    
<no_super_class>