feat: 修改property加载方式

This commit is contained in:
zlt2000
2023-11-25 10:57:08 +08:00
parent cb77754ca2
commit c91f01aea1
14 changed files with 0 additions and 27 deletions
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* 索引配置 * 索引配置
@@ -15,7 +14,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.indices") @ConfigurationProperties(prefix = "zlt.indices")
@RefreshScope @RefreshScope
@Component
public class IndexProperties { public class IndexProperties {
/** /**
* 配置过滤的索引名:默认只显示这些索引 * 配置过滤的索引名:默认只显示这些索引
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* @author zlt * @author zlt
@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.security") @ConfigurationProperties(prefix = "zlt.security")
@RefreshScope @RefreshScope
@Component
public class SecurityProperties { public class SecurityProperties {
private AuthProperties auth = new AuthProperties(); private AuthProperties auth = new AuthProperties();
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* Token配置 * Token配置
@@ -20,7 +19,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.oauth2.token.store") @ConfigurationProperties(prefix = "zlt.oauth2.token.store")
@RefreshScope @RefreshScope
@Component
public class TokenStoreProperties { public class TokenStoreProperties {
/** /**
* token存储类型(redis/db/authJwt/resJwt) * token存储类型(redis/db/authJwt/resJwt)
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@@ -17,7 +16,6 @@ import java.util.Set;
*/ */
@ConfigurationProperties(prefix = "zlt.datascope") @ConfigurationProperties(prefix = "zlt.datascope")
@Data @Data
@Component
public class DataScopeProperties { public class DataScopeProperties {
private static final Set<String> INGORE_SQL_ID = ImmutableSet private static final Set<String> INGORE_SQL_ID = ImmutableSet
.of("com.central.user.mapper.findRolesByUserId" .of("com.central.user.mapper.findRolesByUserId"
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -18,7 +17,6 @@ import java.util.List;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.tenant") @ConfigurationProperties(prefix = "zlt.tenant")
@RefreshScope @RefreshScope
@Component
public class TenantProperties { public class TenantProperties {
/** /**
* 是否开启多租户 * 是否开启多租户
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* mybatis-plus 配置 * mybatis-plus 配置
@@ -19,7 +18,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.mybatis-plus.auto-fill") @ConfigurationProperties(prefix = "zlt.mybatis-plus.auto-fill")
@RefreshScope @RefreshScope
@Component
public class MybatisPlusAutoFillProperties { public class MybatisPlusAutoFillProperties {
/** /**
* 是否开启自动填充字段 * 是否开启自动填充字段
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* es的httpClient连接池配置 * es的httpClient连接池配置
@@ -19,7 +18,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.elasticsearch.rest-pool") @ConfigurationProperties(prefix = "zlt.elasticsearch.rest-pool")
@RefreshScope @RefreshScope
@Component
public class RestClientPoolProperties { public class RestClientPoolProperties {
/** /**
* 链接建立超时时间 * 链接建立超时时间
@@ -3,7 +3,6 @@ package com.central.common.lb.config;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* RestTemplate 配置 * RestTemplate 配置
@@ -17,7 +16,6 @@ import org.springframework.stereotype.Component;
@Setter @Setter
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.rest-template") @ConfigurationProperties(prefix = "zlt.rest-template")
@Component
public class RestTemplateProperties { public class RestTemplateProperties {
/** /**
* 最大链接数 * 最大链接数
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* 审计日志配置 * 审计日志配置
@@ -19,7 +18,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.audit-log") @ConfigurationProperties(prefix = "zlt.audit-log")
@RefreshScope @RefreshScope
@Component
public class AuditLogProperties { public class AuditLogProperties {
/** /**
* 是否开启审计日志 * 是否开启审计日志
@@ -5,7 +5,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* 日志数据源配置 * 日志数据源配置
@@ -21,6 +20,5 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.audit-log.datasource") @ConfigurationProperties(prefix = "zlt.audit-log.datasource")
@ConditionalOnClass(HikariConfig.class) @ConditionalOnClass(HikariConfig.class)
@Component
public class LogDbProperties extends HikariConfig { public class LogDbProperties extends HikariConfig {
} }
@@ -4,7 +4,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/** /**
* 日志链路追踪配置 * 日志链路追踪配置
@@ -16,7 +15,6 @@ import org.springframework.stereotype.Component;
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.trace") @ConfigurationProperties(prefix = "zlt.trace")
@RefreshScope @RefreshScope
@Component
public class TraceProperties { public class TraceProperties {
/** /**
* 是否开启日志链路追踪 * 是否开启日志链路追踪
@@ -3,7 +3,6 @@ package com.central.oss.properties;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* @author zlt * @author zlt
@@ -3,7 +3,6 @@ package com.central.common.redis.properties;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@@ -14,7 +13,6 @@ import java.util.List;
@Setter @Setter
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.cache-manager") @ConfigurationProperties(prefix = "zlt.cache-manager")
@Component
public class CacheManagerProperties { public class CacheManagerProperties {
private List<CacheConfig> configs; private List<CacheConfig> configs;
@@ -3,7 +3,6 @@ package com.central.common.zookeeper.properties;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* zookeeper配置 * zookeeper配置
@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component;
@Setter @Setter
@Getter @Getter
@ConfigurationProperties(prefix = "zlt.zookeeper") @ConfigurationProperties(prefix = "zlt.zookeeper")
@Component
public class ZookeeperProperty { public class ZookeeperProperty {
/** /**
* zk连接集群,多个用逗号隔开 * zk连接集群,多个用逗号隔开