diff --git a/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/integration/log4j2/DataMaskerStringLayout.java b/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/integration/log4j2/DataMaskerStringLayout.java
index f9c4182a4..1102a188d 100644
--- a/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/integration/log4j2/DataMaskerStringLayout.java
+++ b/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/integration/log4j2/DataMaskerStringLayout.java
@@ -42,7 +42,7 @@
* @author gyl
* @since 2.4.13
*/
-@Plugin(name = "MaskingStringLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE, printObject = true)
+@Plugin(name = "DataMaskerStringLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE, printObject = true)
public class DataMaskerStringLayout extends AbstractStringLayout {
private static final String KEY = "Converter";
diff --git a/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/support/DataMaskerHelper.java b/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/support/DataMaskerHelper.java
index 371f19fd1..646099cc3 100644
--- a/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/support/DataMaskerHelper.java
+++ b/eden-components/eden-solutions/eden-data-masker/src/main/java/org/ylzl/eden/data/masker/support/DataMaskerHelper.java
@@ -58,7 +58,7 @@ public static DataMasker build(String spi, String strategy) {
*/
public static DataMasker build(DataMaskerConfig config) {
return ExtensionLoader.getExtensionLoader(DataMaskerBuilder.class)
- .getDefaultExtension()
+ .getExtension(config.getType())
.config(config)
.build();
}
diff --git a/eden-components/eden-solutions/eden-data-masker/src/main/resources/META-INF/data-masker/org.ylzl.eden.data.masker.DataMasker b/eden-components/eden-solutions/eden-data-masker/src/main/resources/META-INF/data-masker/org.ylzl.eden.data.masker.DataMasker
index a8d67a7b4..b0a5b41d9 100644
--- a/eden-components/eden-solutions/eden-data-masker/src/main/resources/META-INF/data-masker/org.ylzl.eden.data.masker.DataMasker
+++ b/eden-components/eden-solutions/eden-data-masker/src/main/resources/META-INF/data-masker/org.ylzl.eden.data.masker.DataMasker
@@ -1,3 +1,4 @@
+chars-scan=org.ylzl.eden.data.masker.integration.charsscan.CharsScanDataMasker
address=org.ylzl.eden.data.masker.spi.AddressDataMasker
bank-card=org.ylzl.eden.data.masker.spi.BankCardDataMasker
car-license=org.ylzl.eden.data.masker.spi.CarLicenseDataMasker
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTimeToLiveIdempotentAutoConfiguration.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTimeToLiveIdempotentAutoConfiguration.java
index ff037b386..d5efe348b 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTimeToLiveIdempotentAutoConfiguration.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTimeToLiveIdempotentAutoConfiguration.java
@@ -28,8 +28,8 @@
import org.springframework.context.annotation.Role;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.ylzl.eden.idempotent.integration.ttl.RedisTimeToLiveIdempotentStrategy;
-import org.ylzl.eden.idempotent.spring.boot.env.TimeToLiveIdempotentConvertor;
-import org.ylzl.eden.idempotent.spring.boot.env.TimeToLiveIdempotentProperties;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentConvertor;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentProperties;
import org.ylzl.eden.idempotent.strategy.TimeToLiveIdempotentStrategy;
/**
@@ -48,15 +48,16 @@
@Configuration(proxyBeanMethods = false)
public class RedisTimeToLiveIdempotentAutoConfiguration {
- public static final String ENABLED = TimeToLiveIdempotentProperties.PREFIX + ".redis.enabled";
+ public static final String ENABLED = IdempotentProperties.TimeToLive.PREFIX + ".redis.enabled";
private static final String AUTOWIRED_REDIS_TTL_IDEMPOTENT_STRATEGY = "Autowired RedisTimeToLiveIdempotentStrategy";
- private final TimeToLiveIdempotentProperties properties;
+ private final IdempotentProperties properties;
@Bean
public TimeToLiveIdempotentStrategy ttlIdempotentStrategy(StringRedisTemplate redisTemplate) {
log.debug(AUTOWIRED_REDIS_TTL_IDEMPOTENT_STRATEGY);
- return new RedisTimeToLiveIdempotentStrategy(redisTemplate, TimeToLiveIdempotentConvertor.INSTANCE.toConfig(properties));
+ return new RedisTimeToLiveIdempotentStrategy(redisTemplate,
+ IdempotentConvertor.INSTANCE.toTimeToLiveConfig(properties.getTtl()));
}
}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTokenIdempotentAutoConfiguration.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTokenIdempotentAutoConfiguration.java
index 2787b916c..9c387af2c 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTokenIdempotentAutoConfiguration.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/RedisTokenIdempotentAutoConfiguration.java
@@ -27,8 +27,8 @@
import org.springframework.context.annotation.Role;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.ylzl.eden.idempotent.integration.token.RedisTokenIdempotentStrategy;
-import org.ylzl.eden.idempotent.spring.boot.env.TokenIdempotentConvertor;
-import org.ylzl.eden.idempotent.spring.boot.env.TokenIdempotentProperties;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentConvertor;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentProperties;
import org.ylzl.eden.idempotent.strategy.TokenIdempotentStrategy;
/**
@@ -46,15 +46,16 @@
@Configuration(proxyBeanMethods = false)
public class RedisTokenIdempotentAutoConfiguration {
- public static final String ENABLED = TokenIdempotentProperties.PREFIX + ".redis.enabled";
+ public static final String ENABLED = IdempotentProperties.Token.PREFIX + ".redis.enabled";
private static final String AUTOWIRED_REDIS_TOKEN_IDEMPOTENT_STRATEGY = "Autowired RedisTokenIdempotentStrategy";
- private final TokenIdempotentProperties properties;
+ private final IdempotentProperties properties;
@Bean
public TokenIdempotentStrategy tokenIdempotentStrategy(StringRedisTemplate redisTemplate) {
log.debug(AUTOWIRED_REDIS_TOKEN_IDEMPOTENT_STRATEGY);
- return new RedisTokenIdempotentStrategy(redisTemplate, TokenIdempotentConvertor.INSTANCE.toConfig(properties));
+ return new RedisTokenIdempotentStrategy(redisTemplate,
+ IdempotentConvertor.INSTANCE.toTokenConfig(properties.getToken()));
}
}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TimeToLiveIdempotentAutoConfiguration.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TimeToLiveIdempotentAutoConfiguration.java
index 60165c08c..359d4509f 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TimeToLiveIdempotentAutoConfiguration.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TimeToLiveIdempotentAutoConfiguration.java
@@ -24,7 +24,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Role;
-import org.ylzl.eden.idempotent.spring.boot.env.TimeToLiveIdempotentProperties;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentProperties;
/**
* 幂等请求自动装配
@@ -32,8 +32,8 @@
* @author gyl
* @since 2.4.13
*/
-@ConditionalOnProperty(prefix = TimeToLiveIdempotentProperties.PREFIX)
-@EnableConfigurationProperties(TimeToLiveIdempotentProperties.class)
+@ConditionalOnProperty(prefix = IdempotentProperties.TimeToLive.PREFIX)
+@EnableConfigurationProperties(IdempotentProperties.class)
@RequiredArgsConstructor
@Import(TimeToLiveIdempotentAspectRegistrar.class)
@Slf4j
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TokenIdempotentAutoConfiguration.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TokenIdempotentAutoConfiguration.java
index 25591f26c..3f37053ca 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TokenIdempotentAutoConfiguration.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/autoconfigure/TokenIdempotentAutoConfiguration.java
@@ -25,7 +25,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.ylzl.eden.commons.lang.StringUtils;
-import org.ylzl.eden.idempotent.spring.boot.env.TokenIdempotentProperties;
+import org.ylzl.eden.idempotent.spring.boot.env.IdempotentProperties;
import org.ylzl.eden.idempotent.strategy.TokenIdempotentStrategy;
import org.ylzl.eden.idempotent.web.controller.TokenIdempotentController;
import org.ylzl.eden.idempotent.web.interceptor.TokenIdempotentInterceptor;
@@ -36,8 +36,8 @@
* @author gyl
* @since 2.4.13
*/
-@ConditionalOnProperty(prefix = TokenIdempotentProperties.PREFIX)
-@EnableConfigurationProperties(TokenIdempotentProperties.class)
+@ConditionalOnProperty(prefix = IdempotentProperties.Token.PREFIX)
+@EnableConfigurationProperties(IdempotentProperties.class)
@RequiredArgsConstructor
@Slf4j
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@@ -48,7 +48,7 @@ public class TokenIdempotentAutoConfiguration {
private static final String AUTOWIRED_IDEMPOTENT_TOKEN_INTERCEPTOR = "Autowired TokenIdempotentInterceptor";
- private final TokenIdempotentProperties properties;
+ private final IdempotentProperties properties;
@Bean
public TokenIdempotentController idempotentTokenController(TokenIdempotentStrategy strategy) {
@@ -60,8 +60,8 @@ public TokenIdempotentController idempotentTokenController(TokenIdempotentStrate
public TokenIdempotentInterceptor idempotentTokenInterceptor(TokenIdempotentStrategy strategy) {
log.debug(AUTOWIRED_IDEMPOTENT_TOKEN_INTERCEPTOR);
TokenIdempotentInterceptor interceptor = new TokenIdempotentInterceptor(strategy);
- if (StringUtils.isNotBlank(properties.getTokenName())) {
- interceptor.setTokenName(properties.getTokenName());
+ if (StringUtils.isNotBlank(properties.getToken().getTokenName())) {
+ interceptor.setTokenName(properties.getToken().getTokenName());
}
return interceptor;
}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentConvertor.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentConvertor.java
similarity index 77%
rename from eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentConvertor.java
rename to eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentConvertor.java
index eb9aaec01..b19cce8a4 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentConvertor.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentConvertor.java
@@ -21,6 +21,7 @@
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;
import org.ylzl.eden.idempotent.config.TimeToLiveIdempotentConfig;
+import org.ylzl.eden.idempotent.config.TokenIdempotentConfig;
/**
* 幂等配置转换器
@@ -30,9 +31,11 @@
*/
@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
-public interface TimeToLiveIdempotentConvertor {
+public interface IdempotentConvertor {
- TimeToLiveIdempotentConvertor INSTANCE = Mappers.getMapper(TimeToLiveIdempotentConvertor.class);
+ IdempotentConvertor INSTANCE = Mappers.getMapper(IdempotentConvertor.class);
- TimeToLiveIdempotentConfig toConfig(TimeToLiveIdempotentProperties properties);
+ TokenIdempotentConfig toTokenConfig(IdempotentProperties.Token properties);
+
+ TimeToLiveIdempotentConfig toTimeToLiveConfig(IdempotentProperties.TimeToLive properties);
}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentProperties.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentProperties.java
similarity index 58%
rename from eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentProperties.java
rename to eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentProperties.java
index 8a1b4ce13..aee213569 100644
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentProperties.java
+++ b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/IdempotentProperties.java
@@ -30,16 +30,36 @@
*/
@Getter
@Setter
-@ConfigurationProperties(prefix = TokenIdempotentProperties.PREFIX)
-public class TokenIdempotentProperties {
+@ConfigurationProperties(prefix = IdempotentProperties.PREFIX)
+public class IdempotentProperties {
- public static final String PREFIX = "idempotent.token";
+ public static final String PREFIX = "idempotent";
- private String prefix = "idempotent:token";
+ private final Token token = new Token();
- private long ttl = 10L;
+ private final TimeToLive ttl = new TimeToLive();
- private TimeUnit timeUnit = TimeUnit.SECONDS;
+ @Getter
+ @Setter
+ public static class Token {
- private String tokenName = "idempotent";
+ public static final String PREFIX = "idempotent.token";
+
+ private String prefix = "idempotent:token";
+
+ private long ttl = 10L;
+
+ private TimeUnit timeUnit = TimeUnit.SECONDS;
+
+ private String tokenName = "idempotent";
+ }
+
+ @Getter
+ @Setter
+ public static class TimeToLive {
+
+ public static final String PREFIX = "idempotent.ttl";
+
+ private String prefix = "idempotent:ttl";
+ }
}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentProperties.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentProperties.java
deleted file mode 100644
index b6142f3b5..000000000
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TimeToLiveIdempotentProperties.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.ylzl.eden.idempotent.spring.boot.env;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * 幂等请求配置
- *
- * @author gyl
- * @since 2.4.13
- */
-@Getter
-@Setter
-@ConfigurationProperties(prefix = TimeToLiveIdempotentProperties.PREFIX)
-public class TimeToLiveIdempotentProperties {
-
- public static final String PREFIX = "idempotent.ttl";
-
- private String prefix = "idempotent:ttl";
-}
diff --git a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentConvertor.java b/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentConvertor.java
deleted file mode 100644
index 858c9f1b9..000000000
--- a/eden-components/eden-spring-boot-starters/eden-idempotent-spring-boot-starter/src/main/java/org/ylzl/eden/idempotent/spring/boot/env/TokenIdempotentConvertor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2012-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.ylzl.eden.idempotent.spring.boot.env;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.NullValueCheckStrategy;
-import org.mapstruct.NullValuePropertyMappingStrategy;
-import org.mapstruct.factory.Mappers;
-import org.ylzl.eden.idempotent.config.TokenIdempotentConfig;
-
-/**
- * 幂等配置转换器
- *
- * @author gyl
- * @since 2.4.13
- */
-@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
- nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
-public interface TokenIdempotentConvertor {
-
- TokenIdempotentConvertor INSTANCE = Mappers.getMapper(TokenIdempotentConvertor.class);
-
- TokenIdempotentConfig toConfig(TokenIdempotentProperties properties);
-}