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

com.houkunlin.system.dict.starter.SystemDictRegistrarAutoConfiguration 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;

import com.houkunlin.system.dict.starter.bytecode.IDictConverterGenerate;
import com.houkunlin.system.dict.starter.bytecode.IDictConverterGenerateAsmImpl;
import com.houkunlin.system.dict.starter.bytecode.IDictConverterGenerateJavassistImpl;
import com.houkunlin.system.dict.starter.provider.SystemDictProvider;
import javassist.ClassPool;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置 {@link SystemDictScanRegistrar} 所需要的 Bean
 *
 * @author HouKunLin
 * @see SystemDictScanRegistrar
 */
@Getter
@Configuration(proxyBeanMethods = false)
@RequiredArgsConstructor
public class SystemDictRegistrarAutoConfiguration {
    /**
     * 系统字典存储提供者
     *
     * @return 系统字典提供者
     */
    @ConditionalOnMissingBean
    @Bean
    public SystemDictProvider systemDictProvider() {
        return new SystemDictProvider();
    }

    /**
     * ASM 字节码编码实现
     *
     * @return IDictConverterGenerate
     */
    @ConditionalOnProperty(prefix = "system.dict", name = "bytecode", havingValue = "ASM")
    @ConditionalOnMissingBean
    @Bean
    public IDictConverterGenerate dictConverterGenerateAsm() {
        return new IDictConverterGenerateAsmImpl();
    }

    /**
     * JAVASSIST 字节码编码实现
     *
     * @return IDictConverterGenerate
     */
    @ConditionalOnProperty(prefix = "system.dict", name = "bytecode", havingValue = "JAVASSIST", matchIfMissing = true)
    @ConditionalOnClass(ClassPool.class)
    @ConditionalOnMissingBean
    @Bean
    public IDictConverterGenerate dictConverterGenerateJavassist() {
        return new IDictConverterGenerateJavassistImpl();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy