All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.redis.RedisCacheCloudPropertiesAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.redis;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.util.ClassUtils;
import org.zodiac.autoconfigure.redis.condition.ConditionalOnRedisEnabled;
import org.zodiac.commons.constants.SystemPropertiesConstants;

@SpringBootConfiguration
@ConditionalOnRedisEnabled
@ConditionalOnClass(value = {org.springframework.data.redis.core.RedisOperations.class})
public class RedisCacheCloudPropertiesAutoConfiguration {

    public RedisCacheCloudPropertiesAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    //@ConditionalOnMissingClass(value = {"org.redisson.Redisson"})
    @ConfigurationProperties(prefix = SystemPropertiesConstants.Zodiac.SPRING_REDIS_PREFIX, ignoreInvalidFields = true)
    protected RedisCacheCloudProperties redisCacheCloudProperties() {
        boolean redissonLoaded = ClassUtils.isPresent("org.redisson.Redisson", RedisConfigAutoConfiguration.class.getClassLoader());
        return redissonLoaded ? new RedisCacheCloudRedissonProperties() : new RedisCacheCloudProperties();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy