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

com.houkunlin.system.dict.starter.store.LocalDictStoreConfiguration Maven / Gradle / Ivy

Go to download

系统数据字典自动翻译成字典文本。可集合系统数据库中存储的用户数据字典,也可使用枚举做系统数据字典,主要用在返回数据给前端时自动把字典值翻译成字典文本信息; The system data dictionary is automatically translated into dictionary text. The user data dictionary stored in the system database can be aggregated, and the enumeration can also be used as the system data dictionary. It is mainly used to automatically translate dictionary values into dictionary text information when returning data to the front end.

The newest version!
package com.houkunlin.system.dict.starter.store;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 本地字典存储配置
 *
 * @author HouKunLin
 */
@Configuration(proxyBeanMethods = false)
public class LocalDictStoreConfiguration {
    /**
     * 当环境中不存在 DictStore Bean 的时候创建一个默认的 DictStore Bean 实例
     *
     * @return {@link DictStore}
     */
    @ConditionalOnProperty(prefix = "system.dict", name = "store-type", havingValue = "AUTO", matchIfMissing = true)
    @ConditionalOnMissingClass("org.springframework.data.redis.core.RedisTemplate")
    @Bean
    @ConditionalOnMissingBean
    public DictStore dictStoreAuto(final RemoteDict remoteDict) {
        return new LocalDictStore(remoteDict);
    }

    /**
     * 当环境中不存在 DictStore Bean 的时候创建一个默认的 DictStore Bean 实例
     *
     * @return {@link DictStore}
     */
    @ConditionalOnProperty(prefix = "system.dict", name = "store-type", havingValue = "LOCAL")
    @Bean
    @ConditionalOnMissingBean
    public DictStore dictStoreLocal(final RemoteDict remoteDict) {
        return new LocalDictStore(remoteDict);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy