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

net.guerlab.spring.commons.autoconfigure.SequenceAutoconfigure Maven / Gradle / Ivy

There is a newer version: 2.1.5
Show newest version
package net.guerlab.spring.commons.autoconfigure;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import net.guerlab.spring.commons.properties.SequenceProperties;
import net.guerlab.spring.commons.sequence.Sequence;

/**
 * 分布式序列自动配置
 *
 * @author guer
 *
 */
@Configuration
@EnableConfigurationProperties(SequenceProperties.class)
public class SequenceAutoconfigure {

    /**
     * 分布式序列自动配置
     * 
     * @param properties
     *            分布式序列自动配置属性
     * @return 分布式序列
     */
    @Bean
    @RefreshScope
    public Sequence sequence(SequenceProperties properties) {
        return new Sequence(properties.getWorkerId(), properties.getDataCenterId());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy