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

io.github.spitmaster.warlock.config.WarlockWithRedissonAutoConfiguration Maven / Gradle / Ivy

Go to download

warlock-spring-boot-starter is an annotation-driven concurrency tools library for java with Spring. It is easy to use in Spring application Just using annotation on your method , the concurrency lock problem would be solved

There is a newer version: 1.0.1
Show newest version
package io.github.spitmaster.warlock.config;

import io.github.spitmaster.warlock.core.factory.RedissonProvider;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 在有Redisson的情况下的配置
 * warlock的默认配置
 *
 * @author zhouyijin
 */
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(RedissonClient.class)
@ConditionalOnProperty(name = "warlock.enabled", matchIfMissing = true)
public class WarlockWithRedissonAutoConfiguration {

    @Bean
    public RedissonProvider redissonProvider(BeanFactory beanFactory) {
        return () -> beanFactory
                .getBeanProvider(RedissonClient.class)
                .getIfAvailable();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy