chore: 移除 lombok 依赖

再度精简依赖
This commit is contained in:
jasmine
2024-01-31 06:02:17 +00:00
committed by Charles7c
parent e1b7fea24f
commit 0eb6afabb6
70 changed files with 1437 additions and 190 deletions

View File

@@ -17,8 +17,8 @@
package top.charles7c.continew.starter.log.httptracepro.autoconfigure;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -37,16 +37,19 @@ import top.charles7c.continew.starter.log.httptracepro.handler.LogInterceptor;
* @author Charles7c
* @since 1.1.0
*/
@Slf4j
@Configuration
@ConditionalOnEnabledLog
@RequiredArgsConstructor
@EnableConfigurationProperties(LogProperties.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class LogAutoConfiguration implements WebMvcConfigurer {
private static final Logger log = LoggerFactory.getLogger(LogAutoConfiguration.class);
private final LogProperties logProperties;
public LogAutoConfiguration(LogProperties logProperties) {
this.logProperties = logProperties;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LogInterceptor(logDao(), logProperties));

View File

@@ -16,7 +16,6 @@
package top.charles7c.continew.starter.log.httptracepro.autoconfigure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
import top.charles7c.continew.starter.log.common.enums.Include;
@@ -30,7 +29,6 @@ import java.util.Set;
* @author Charles7c
* @since 1.1.0
*/
@Data
@ConfigurationProperties(PropertiesConstants.LOG)
public class LogProperties {
@@ -48,4 +46,33 @@ public class LogProperties {
* 包含信息
*/
private Set<Include> include = new HashSet<>(Include.defaultIncludes());
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public Boolean getIsPrint() {
return isPrint;
}
public void setIsPrint(Boolean print) {
isPrint = print;
}
public Set<Include> getInclude() {
return include;
}
public void setInclude(Set<Include> include) {
this.include = include;
}
@Override
public String toString() {
return "LogProperties{" + "enabled=" + enabled + ", isPrint=" + isPrint + ", include=" + include + '}';
}
}

View File

@@ -20,7 +20,6 @@ import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.core.Ordered;
import org.springframework.lang.NonNull;
import org.springframework.web.filter.OncePerRequestFilter;
@@ -47,11 +46,14 @@ import java.util.Set;
* @author Charles7c
* @since 1.1.0
*/
@RequiredArgsConstructor
public class LogFilter extends OncePerRequestFilter implements Ordered {
private final LogProperties logProperties;
public LogFilter(LogProperties logProperties) {
this.logProperties = logProperties;
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE - 10;

View File

@@ -24,8 +24,8 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.lang.NonNull;
import org.springframework.web.method.HandlerMethod;
@@ -46,14 +46,18 @@ import java.util.Set;
* @author Charles7c
* @since 1.1.0
*/
@Slf4j
@RequiredArgsConstructor
public class LogInterceptor implements HandlerInterceptor {
private static final Logger log = LoggerFactory.getLogger(LogInterceptor.class);
private final LogDao logDao;
private final LogProperties logProperties;
private final TransmittableThreadLocal<LogRecord.Started> timestampTtl = new TransmittableThreadLocal<>();
public LogInterceptor(LogDao logDao, LogProperties logProperties) {
this.logDao = logDao;
this.logProperties = logProperties;
}
@Override
public boolean preHandle(@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response,