package com.kmall.common.utils.redis; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; /** * @author Scott Chen * @since 1.0 * 2018-09-27 */ @Component public class JedisPropertiesConfiguration { private static final String PROD = "prod"; private static final String DEV = "dev"; @Value("${redis.env}") private String evn = DEV; @Autowired private JedisProdProperties jedisProdProperties; @Autowired private JedisDevProperties jedisDevProperties; @Bean public JedisProperties jedisProperties(){ if (evn.equalsIgnoreCase(PROD)) { return jedisProdProperties; }else { return jedisDevProperties; } } }