Skip to content

Commit

Permalink
chore: 优化属性前缀命名
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Jun 28, 2024
1 parent 0ad7b18 commit 6b90880
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
import io.swagger.v3.oas.models.Components;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import top.continew.starter.core.constant.PropertiesConstants;

/**
* API 文档扩展配置属性
*
* @author Charles7c
* @since 1.0.1
*/
@ConfigurationProperties(prefix = PropertiesConstants.SPRINGDOC)
@ConfigurationProperties("springdoc")
public class SpringDocExtensionProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(prefix = "sa-token.extension")
@ConfigurationProperties("sa-token.extension")
public class SaTokenExtensionProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(prefix = "project")
@ConfigurationProperties("project")
public class ProjectProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(prefix = "spring.task")
@ConfigurationProperties("spring.task")
public class ThreadPoolExtensionProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ public class PropertiesConstants {
*/
public static final String ENABLED = "enabled";

/**
* Spring Doc 配置
*/
public static final String SPRINGDOC = "springdoc";

/**
* Spring Doc Swagger UI 配置
*/
public static final String SPRINGDOC_SWAGGER_UI = SPRINGDOC + StringConstants.DOT + "swagger-ui";

/**
* 安全配置
*/
Expand All @@ -52,12 +42,17 @@ public class PropertiesConstants {
/**
* 密码编解码配置
*/
public static final String PASSWORD = SECURITY + StringConstants.DOT + "password";
public static final String SECURITY_PASSWORD = SECURITY + StringConstants.DOT + "password";

/**
* 加/解密配置
*/
public static final String CRYPTO = SECURITY + StringConstants.DOT + "crypto";
public static final String SECURITY_CRYPTO = SECURITY + StringConstants.DOT + "crypto";

/**
* 限流器配置
*/
public static final String SECURITY_LIMITER = SECURITY + StringConstants.DOT + "limiter";

/**
* Web 配置
Expand All @@ -67,17 +62,22 @@ public class PropertiesConstants {
/**
* 跨域配置
*/
public static final String CORS = WEB + StringConstants.DOT + "cors";
public static final String WEB_CORS = WEB + StringConstants.DOT + "cors";

/**
* 链路配置
*/
public static final String TRACE = WEB + StringConstants.DOT + "trace";
public static final String WEB_TRACE = WEB + StringConstants.DOT + "trace";

/**
* XSS 配置
*/
public static final String XSS = WEB + StringConstants.DOT + "xss";
public static final String WEB_XSS = WEB + StringConstants.DOT + "xss";

/**
* 国际化配置
*/
public static final String WEB_I18N = WEB + StringConstants.DOT + "i18n";

/**
* 日志配置
Expand Down Expand Up @@ -119,11 +119,6 @@ public class PropertiesConstants {
*/
public static final String MESSAGING_WEBSOCKET = MESSAGING + StringConstants.DOT + "websocket";

/**
* 国际化配置
*/
public static final String I18N = WEB + StringConstants.DOT + "i18n";

private PropertiesConstants() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(prefix = "mybatis-flex.extension")
@ConfigurationProperties("mybatis-flex.extension")
public class MyBatisFlexExtensionProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(prefix = "mybatis-plus.extension")
@ConfigurationProperties("mybatis-plus.extension")
public class MyBatisPlusExtensionProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
@AutoConfiguration
@EnableConfigurationProperties(CryptoProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.CRYPTO, name = PropertiesConstants.ENABLED, matchIfMissing = true)
@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_CRYPTO, name = PropertiesConstants.ENABLED, matchIfMissing = true)
public class CryptoAutoConfiguration {

private static final Logger log = LoggerFactory.getLogger(CryptoAutoConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @author Charles7c
* @since 1.4.0
*/
@ConfigurationProperties(PropertiesConstants.CRYPTO)
@ConfigurationProperties(PropertiesConstants.SECURITY_CRYPTO)
public class CryptoProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Map<String, FieldEncrypt> getEncryptParams(String mappedStatementId) {
*/
public Map<String, FieldEncrypt> getEncryptParams(String mappedStatementId, Integer parameterIndex) {
return ENCRYPT_PARAM_CACHE
.computeIfAbsent(mappedStatementId, m -> getEncryptParamsNoCached(mappedStatementId, parameterIndex));
.computeIfAbsent(mappedStatementId, key -> getEncryptParamsNoCached(mappedStatementId, parameterIndex));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*/
@AutoConfiguration
@EnableConfigurationProperties(PasswordEncoderProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.PASSWORD, name = PropertiesConstants.ENABLED, matchIfMissing = true)
@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_PASSWORD, name = PropertiesConstants.ENABLED, matchIfMissing = true)
public class PasswordEncoderAutoConfiguration {

private static final Logger log = LoggerFactory.getLogger(PasswordEncoderAutoConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @author Jasmine
* @since 1.3.0
*/
@ConfigurationProperties(PropertiesConstants.PASSWORD)
@ConfigurationProperties(PropertiesConstants.SECURITY_PASSWORD)
public class PasswordEncoderProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@Lazy
@AutoConfiguration
@ConditionalOnWebApplication
@ConditionalOnProperty(prefix = PropertiesConstants.CORS, name = PropertiesConstants.ENABLED, havingValue = "true")
@ConditionalOnProperty(prefix = PropertiesConstants.WEB_CORS, name = PropertiesConstants.ENABLED, havingValue = "true")
@EnableConfigurationProperties(CorsProperties.class)
public class CorsAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(CorsAutoConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @author Charles7c
* @since 1.0.0
*/
@ConfigurationProperties(PropertiesConstants.CORS)
@ConfigurationProperties(PropertiesConstants.WEB_CORS)
public class CorsProperties {

private static final List<String> ALL = Collections.singletonList(StringConstants.ASTERISK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import top.continew.starter.core.constant.PropertiesConstants;

/**
* 国际化 配置属性
* 国际化配置属性
*
* @author Jasmine
* @since 2.2.0
*/
@ConfigurationProperties(prefix = PropertiesConstants.I18N)
@ConfigurationProperties(PropertiesConstants.WEB_I18N)
public class I18nProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@AutoConfiguration
@ConditionalOnWebApplication
@EnableConfigurationProperties(TraceProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.TRACE, name = PropertiesConstants.ENABLED, havingValue = "true")
@ConditionalOnProperty(prefix = PropertiesConstants.WEB_TRACE, name = PropertiesConstants.ENABLED, havingValue = "true")
public class TraceAutoConfiguration {

private static final Logger log = LoggerFactory.getLogger(TraceAutoConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Charles7c
* @since 1.3.0
*/
@ConfigurationProperties(PropertiesConstants.TRACE)
@ConfigurationProperties(PropertiesConstants.WEB_TRACE)
public class TraceProperties {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@AutoConfiguration
@ConditionalOnWebApplication
@EnableConfigurationProperties(XssProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.XSS, name = PropertiesConstants.ENABLED, havingValue = "true")
@ConditionalOnProperty(prefix = PropertiesConstants.WEB_XSS, name = PropertiesConstants.ENABLED, havingValue = "true")
public class XssAutoConfiguration {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @author whhya
* @since 2.0.0
*/
@ConfigurationProperties(PropertiesConstants.XSS)
@ConfigurationProperties(PropertiesConstants.WEB_XSS)
public class XssProperties {

/**
Expand Down

0 comments on commit 6b90880

Please sign in to comment.