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

org.zodiac.autoconfigure.security.jwt.SecurityJwtRedisAutoConfiguration Maven / Gradle / Ivy

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

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.zodiac.autoconfigure.security.condition.ConditionalOnSecurityJwtEnabled;

import java.time.Duration;

@Order
@EnableCaching
@SpringBootConfiguration
@ConditionalOnSecurityJwtEnabled
//@AutoConfigureAfter(value = {RedisAutoConfiguration.class})
@ConditionalOnClass(value = {org.springframework.data.redis.cache.RedisCacheManager.class, org.springframework.data.redis.core.RedisOperations.class})
public class SecurityJwtRedisAutoConfiguration {

    public SecurityJwtRedisAutoConfiguration() {
        super();
    }

    @Bean(name = "redisCacheManager")
    @ConditionalOnMissingBean(name = "redisCacheManager")
    protected org.springframework.data.redis.cache.RedisCacheManager cacheManager(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) {
        org.springframework.data.redis.cache.RedisCacheConfiguration redisCacheConfiguration =
            org.springframework.data.redis.cache.RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(1));
        return org.springframework.data.redis.cache.RedisCacheManager.builder(org.springframework.data.redis.cache.RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory))
            .cacheDefaults(redisCacheConfiguration).build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy