From 21262701dc40ee9ee92ae05789ade91b59f9d192 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Wed, 26 Mar 2025 20:43:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(web):=20=E8=AF=B7=E6=B1=82=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E5=8F=AF=E9=87=8D=E5=A4=8D=E8=AF=BB=E6=B5=81=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=94=B1=20core=20=E8=B0=83=E6=95=B4=E5=88=B0=20web?= =?UTF-8?q?=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- continew-starter-core/pom.xml | 13 +++--- .../core/constant/PropertiesConstants.java | 35 +++++++-------- continew-starter-dependencies/pom.xml | 45 ++++++++++++------- .../continew-starter-log-core/pom.xml | 6 +++ .../starter/log/filter/LogFilter.java | 4 +- .../RecordableServletHttpResponse.java | 4 +- .../starter/log/model/LogRequest.java | 2 +- .../continew-starter-log-interceptor/pom.xml | 6 --- continew-starter-log/pom.xml | 4 +- continew-starter-web/pom.xml | 6 --- .../web/util}/RepeatReadRequestWrapper.java | 2 +- .../web/util}/RepeatReadResponseWrapper.java | 2 +- ...ot.autoconfigure.AutoConfiguration.imports | 4 +- pom.xml | 7 +-- 14 files changed, 70 insertions(+), 70 deletions(-) rename {continew-starter-core/src/main/java/top/continew/starter/core/wrapper => continew-starter-web/src/main/java/top/continew/starter/web/util}/RepeatReadRequestWrapper.java (98%) rename {continew-starter-core/src/main/java/top/continew/starter/core/wrapper => continew-starter-web/src/main/java/top/continew/starter/web/util}/RepeatReadResponseWrapper.java (99%) diff --git a/continew-starter-core/pom.xml b/continew-starter-core/pom.xml index 6dffc87f..dbd0e3cc 100644 --- a/continew-starter-core/pom.xml +++ b/continew-starter-core/pom.xml @@ -23,6 +23,12 @@ spring-boot-configuration-processor + + + org.aspectj + aspectjweaver + + org.hibernate.validator @@ -59,12 +65,5 @@ cn.hutool hutool-http - - - - jakarta.servlet - jakarta.servlet-api - true - \ No newline at end of file diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/constant/PropertiesConstants.java b/continew-starter-core/src/main/java/top/continew/starter/core/constant/PropertiesConstants.java index 246e89d5..d4ae8c2d 100644 --- a/continew-starter-core/src/main/java/top/continew/starter/core/constant/PropertiesConstants.java +++ b/continew-starter-core/src/main/java/top/continew/starter/core/constant/PropertiesConstants.java @@ -40,45 +40,40 @@ public class PropertiesConstants { public static final String SECURITY = CONTINEW_STARTER + StringConstants.DOT + "security"; /** - * 密码编解码配置 + * 安全-密码编解码配置 */ public static final String SECURITY_PASSWORD = SECURITY + StringConstants.DOT + "password"; /** - * 加/解密配置 + * 安全-加/解密配置 */ public static final String SECURITY_CRYPTO = SECURITY + StringConstants.DOT + "crypto"; /** - * 敏感词配置 + * 安全-敏感词配置 */ public static final String SECURITY_SENSITIVE_WORDS = SECURITY + StringConstants.DOT + "sensitive-words"; + /** + * 安全-XSS 配置 + */ + public static final String SECURITY_XSS = SECURITY + StringConstants.DOT + "xss"; + /** * Web 配置 */ public static final String WEB = CONTINEW_STARTER + StringConstants.DOT + "web"; /** - * 跨域配置 + * Web-跨域配置 */ public static final String WEB_CORS = WEB + StringConstants.DOT + "cors"; /** - * 响应配置 + * Web-响应配置 */ public static final String WEB_RESPONSE = WEB + StringConstants.DOT + "response"; - /** - * 链路配置 - */ - public static final String WEB_TRACE = WEB + StringConstants.DOT + "trace"; - - /** - * XSS 配置 - */ - public static final String WEB_XSS = WEB + StringConstants.DOT + "xss"; - /** * 日志配置 */ @@ -89,11 +84,6 @@ public class PropertiesConstants { */ public static final String STORAGE = CONTINEW_STARTER + StringConstants.DOT + "storage"; - /** - * 本地存储配置 - */ - public static final String STORAGE_LOCAL = STORAGE + StringConstants.DOT + "local"; - /** * 验证码配置 */ @@ -144,6 +134,11 @@ public class PropertiesConstants { */ public static final String IDEMPOTENT = CONTINEW_STARTER + StringConstants.DOT + "idempotent"; + /** + * 链路追踪配置 + */ + public static final String TRACE = CONTINEW_STARTER + StringConstants.DOT + "trace"; + private PropertiesConstants() { } } diff --git a/continew-starter-dependencies/pom.xml b/continew-starter-dependencies/pom.xml index 4459af92..58be60e6 100644 --- a/continew-starter-dependencies/pom.xml +++ b/continew-starter-dependencies/pom.xml @@ -538,20 +538,6 @@ ${revision} - - - top.continew - continew-starter-idempotent - ${revision} - - - - - top.continew - continew-starter-ratelimiter - ${revision} - - top.continew @@ -573,13 +559,33 @@ ${revision} - + top.continew - continew-starter-web + continew-starter-trace ${revision} + + + top.continew + continew-starter-idempotent + ${revision} + + + + + top.continew + continew-starter-ratelimiter + ${revision} + + + + + top.continew + continew-starter-security-xss + + top.continew @@ -608,6 +614,13 @@ ${revision} + + + top.continew + continew-starter-web + ${revision} + + top.continew diff --git a/continew-starter-log/continew-starter-log-core/pom.xml b/continew-starter-log/continew-starter-log-core/pom.xml index 52e44894..dfc3f559 100644 --- a/continew-starter-log/continew-starter-log-core/pom.xml +++ b/continew-starter-log/continew-starter-log-core/pom.xml @@ -18,5 +18,11 @@ io.swagger.core.v3 swagger-annotations-jakarta + + + + com.alibaba + transmittable-thread-local + \ No newline at end of file diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/filter/LogFilter.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/filter/LogFilter.java index 5e4a8976..fd560adb 100644 --- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/filter/LogFilter.java +++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/filter/LogFilter.java @@ -25,8 +25,8 @@ import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.core.Ordered; import org.springframework.lang.NonNull; import org.springframework.web.filter.OncePerRequestFilter; -import top.continew.starter.core.wrapper.RepeatReadRequestWrapper; -import top.continew.starter.core.wrapper.RepeatReadResponseWrapper; +import top.continew.starter.web.util.RepeatReadRequestWrapper; +import top.continew.starter.web.util.RepeatReadResponseWrapper; import top.continew.starter.log.model.LogProperties; import java.io.IOException; diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/servlet/RecordableServletHttpResponse.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/servlet/RecordableServletHttpResponse.java index fb2b4fdb..31f3fde7 100644 --- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/servlet/RecordableServletHttpResponse.java +++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/http/servlet/RecordableServletHttpResponse.java @@ -19,9 +19,9 @@ package top.continew.starter.log.http.servlet; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.json.JSONUtil; import jakarta.servlet.http.HttpServletResponse; -import top.continew.starter.core.wrapper.RepeatReadResponseWrapper; -import top.continew.starter.log.http.RecordableHttpResponse; import top.continew.starter.web.util.ServletUtils; +import top.continew.starter.web.util.RepeatReadResponseWrapper; +import top.continew.starter.log.http.RecordableHttpResponse; import java.util.Map; diff --git a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java index a5f90c00..ac7a1c3b 100644 --- a/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java +++ b/continew-starter-log/continew-starter-log-core/src/main/java/top/continew/starter/log/model/LogRequest.java @@ -20,9 +20,9 @@ import cn.hutool.core.text.CharSequenceUtil; import org.springframework.http.HttpHeaders; import top.continew.starter.core.util.ExceptionUtils; import top.continew.starter.core.util.IpUtils; +import top.continew.starter.web.util.ServletUtils; import top.continew.starter.log.enums.Include; import top.continew.starter.log.http.RecordableHttpRequest; -import top.continew.starter.web.util.ServletUtils; import java.net.URI; import java.util.Map; diff --git a/continew-starter-log/continew-starter-log-interceptor/pom.xml b/continew-starter-log/continew-starter-log-interceptor/pom.xml index 68277947..7d0ed29f 100644 --- a/continew-starter-log/continew-starter-log-interceptor/pom.xml +++ b/continew-starter-log/continew-starter-log-interceptor/pom.xml @@ -13,12 +13,6 @@ ContiNew Starter 日志模块 - 基于拦截器实现(Spring Boot Actuator HttpTrace 增强版) - - - com.alibaba - transmittable-thread-local - - top.continew diff --git a/continew-starter-log/pom.xml b/continew-starter-log/pom.xml index f979c041..2b7ec476 100644 --- a/continew-starter-log/pom.xml +++ b/continew-starter-log/pom.xml @@ -20,10 +20,10 @@ - + top.continew - continew-starter-core + continew-starter-web \ No newline at end of file diff --git a/continew-starter-web/pom.xml b/continew-starter-web/pom.xml index 2ad4e840..792b9dbd 100644 --- a/continew-starter-web/pom.xml +++ b/continew-starter-web/pom.xml @@ -38,12 +38,6 @@ spring-boot-starter-validation - - - com.yomahub - tlog-web-spring-boot-starter - - com.feiniaojin diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadRequestWrapper.java b/continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadRequestWrapper.java similarity index 98% rename from continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadRequestWrapper.java rename to continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadRequestWrapper.java index 73f89e12..e9c36f8c 100644 --- a/continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadRequestWrapper.java +++ b/continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadRequestWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.core.wrapper; +package top.continew.starter.web.util; import cn.hutool.core.io.IoUtil; import jakarta.servlet.ReadListener; diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadResponseWrapper.java b/continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadResponseWrapper.java similarity index 99% rename from continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadResponseWrapper.java rename to continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadResponseWrapper.java index 2bee3325..aa3080cb 100644 --- a/continew-starter-core/src/main/java/top/continew/starter/core/wrapper/RepeatReadResponseWrapper.java +++ b/continew-starter-web/src/main/java/top/continew/starter/web/util/RepeatReadResponseWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.continew.starter.core.wrapper; +package top.continew.starter.web.util; import jakarta.servlet.ServletOutputStream; import jakarta.servlet.WriteListener; diff --git a/continew-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/continew-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index b15bec65..0b58a205 100644 --- a/continew-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/continew-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,2 @@ top.continew.starter.web.autoconfigure.mvc.WebMvcAutoConfiguration -top.continew.starter.web.autoconfigure.cors.CorsAutoConfiguration -top.continew.starter.web.autoconfigure.trace.TraceAutoConfiguration -top.continew.starter.web.autoconfigure.xss.XssAutoConfiguration +top.continew.starter.web.autoconfigure.cors.CorsAutoConfiguration \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2c74a528..cb71816b 100644 --- a/pom.xml +++ b/pom.xml @@ -61,8 +61,11 @@ continew-starter-core continew-starter-json continew-starter-api-doc - continew-starter-security continew-starter-web + continew-starter-security + continew-starter-ratelimiter + continew-starter-idempotent + continew-starter-trace continew-starter-log continew-starter-storage continew-starter-file @@ -71,8 +74,6 @@ continew-starter-data continew-starter-auth continew-starter-messaging - continew-starter-ratelimiter - continew-starter-idempotent continew-starter-extension