package com.blueland.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @auther xcy
 * @create 2022-06-13 9:45
 * 策略工厂模式实现不同租户redis初始数据服务
 */
@Service
public class RedisStrategyService {

    @Autowired
    Map<String, RedisInitService> serviceMap = new HashMap<>();

    public RedisInitService getService(String type) {
        RedisInitService service = serviceMap.get(type);
        if (service == null) {
            throw new RuntimeException("没有找到对应的服务类：" + type);
        }
        return service;
    }

}
