mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 20:57:23 +08:00
perf: 删除多余依赖,格式化代码
删除幂等模块的 springboot-aop 依赖 删除 web 模块的 springboot-Validation 依赖
This commit is contained in:
@@ -13,11 +13,6 @@
|
|||||||
<description>ContiNew Starter 幂等模块</description>
|
<description>ContiNew Starter 幂等模块</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 缓存模块 - Redisson -->
|
<!-- 缓存模块 - Redisson -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
|
@@ -166,14 +166,14 @@ public abstract class AbstractLogHandler implements LogHandler {
|
|||||||
AccessLogProperties properties = accessLogContext.getProperties().getAccessLog();
|
AccessLogProperties properties = accessLogContext.getProperties().getAccessLog();
|
||||||
// 是否需要打印 规则: 是否打印开关 或 放行路径
|
// 是否需要打印 规则: 是否打印开关 或 放行路径
|
||||||
if (!properties.isEnabled() || AccessLogUtils.exclusionPath(accessLogContext.getProperties(), ServletUtils
|
if (!properties.isEnabled() || AccessLogUtils.exclusionPath(accessLogContext.getProperties(), ServletUtils
|
||||||
.getReqPath())) {
|
.getReqPath())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 构建上下文
|
// 构建上下文
|
||||||
logContextThread.set(accessLogContext);
|
logContextThread.set(accessLogContext);
|
||||||
String param = AccessLogUtils.getParam(properties);
|
String param = AccessLogUtils.getParam(properties);
|
||||||
log.info(param != null ? "[Start] [{}] {} param: {}" : "[Start] [{}] {}",
|
log.info(param != null ? "[Start] [{}] {} param: {}" : "[Start] [{}] {}", ServletUtils
|
||||||
ServletUtils.getReqMethod(), ServletUtils.getReqPath(), param);
|
.getReqMethod(), ServletUtils.getReqPath(), param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -185,7 +185,7 @@ public abstract class AbstractLogHandler implements LogHandler {
|
|||||||
try {
|
try {
|
||||||
Duration timeTaken = Duration.between(logContext.getStartTime(), accessLogContext.getEndTime());
|
Duration timeTaken = Duration.between(logContext.getStartTime(), accessLogContext.getEndTime());
|
||||||
log.info("[End] [{}] {} {} {}ms", ServletUtils.getReqMethod(), ServletUtils.getReqPath(), ServletUtils
|
log.info("[End] [{}] {} {} {}ms", ServletUtils.getReqMethod(), ServletUtils.getReqPath(), ServletUtils
|
||||||
.getRespStatus(), timeTaken.toMillis());
|
.getRespStatus(), timeTaken.toMillis());
|
||||||
} finally {
|
} finally {
|
||||||
logContextThread.remove();
|
logContextThread.remove();
|
||||||
}
|
}
|
||||||
|
@@ -32,12 +32,6 @@
|
|||||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Hibernate Validator -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Graceful Response(一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量) -->
|
<!-- Graceful Response(一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.feiniaojin</groupId>
|
<groupId>com.feiniaojin</groupId>
|
||||||
|
@@ -56,7 +56,7 @@ public class ServletUtils extends JakartaServletUtil {
|
|||||||
public static ServletRequestAttributes getRequestAttributes() {
|
public static ServletRequestAttributes getRequestAttributes() {
|
||||||
try {
|
try {
|
||||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||||
return (ServletRequestAttributes) attributes;
|
return (ServletRequestAttributes)attributes;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -231,8 +231,8 @@ public class ServletUtils extends JakartaServletUtil {
|
|||||||
public static Map<String, Object> getReqParam() {
|
public static Map<String, Object> getReqParam() {
|
||||||
String body = getReqBody();
|
String body = getReqBody();
|
||||||
return CharSequenceUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
|
return CharSequenceUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body)
|
||||||
? JSONUtil.toBean(body, Map.class)
|
? JSONUtil.toBean(body, Map.class)
|
||||||
: Collections.unmodifiableMap(JakartaServletUtil.getParamMap(Objects.requireNonNull(getRequest())));
|
: Collections.unmodifiableMap(JakartaServletUtil.getParamMap(Objects.requireNonNull(getRequest())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,7 +329,7 @@ public class ServletUtils extends JakartaServletUtil {
|
|||||||
return new StringBuilder();
|
return new StringBuilder();
|
||||||
}
|
}
|
||||||
return new StringBuilder().append(request.getRequestURL())
|
return new StringBuilder().append(request.getRequestURL())
|
||||||
.append(StringConstants.QUESTION_MARK)
|
.append(StringConstants.QUESTION_MARK)
|
||||||
.append(queryString);
|
.append(queryString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user