refactor(springboot-parent): 升级至 Java 17 及 Jakarta 包迁移

This commit is contained in:
曾文豪
2025-12-11 14:40:52 +08:00
parent 57f0e2ab82
commit cf6d05c2b4
50 changed files with 446 additions and 167 deletions

View File

@@ -6,14 +6,14 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.33</version>
<version>4.0.0.alpha1</version>
</parent>
<artifactId>springboot-web</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -45,6 +45,11 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
@@ -63,12 +68,6 @@
<version>9.0.104</version>
</dependency>
<!-- aspect -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>

View File

@@ -7,7 +7,7 @@ import com.tiesheng.util.exception.ApiRespEnum;
import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.web.service.TieshengWebConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties;
import org.springframework.boot.servlet.autoconfigure.MultipartProperties;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;

View File

@@ -3,10 +3,10 @@ package com.tiesheng.web.config.json;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverters;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -16,16 +16,11 @@ import java.util.List;
* @author hao
*/
@Configuration
public class FastJsonMessageConverter {
public class FastJsonMessageConverter implements WebMvcConfigurer {
/**
* 配置FastJson
*
* @return HttpMessageConverters
*/
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
@Override
public void configureMessageConverters(HttpMessageConverters.ServerBuilder builder) {
FastJsonConfig config = new FastJsonConfig();
config.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
@@ -37,7 +32,7 @@ public class FastJsonMessageConverter {
fastConverter.setDefaultCharset(StandardCharsets.UTF_8);
fastConverter.setSupportedMediaTypes(mediaTypes);
return new HttpMessageConverters(fastConverter);
builder.addCustomConverter(fastConverter);
}
}

View File

@@ -11,11 +11,6 @@ import com.tiesheng.annotation.operation.OperationLog;
import com.tiesheng.util.ServletKit;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.web.service.CoreLogService;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@@ -17,9 +17,9 @@ import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Component;
import jakarta.servlet.http.HttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.annotation.AnnotationUtil;
import cn.hutool.core.date.DateUtil;
import com.tiesheng.annotation.role.RoleAuthority;
import com.tiesheng.util.service.role.TsAuthorityHandler;
import jakarta.annotation.Resource;
import org.springframework.aop.support.AopUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.ApplicationContext;
@@ -11,7 +12,6 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;

View File

@@ -12,12 +12,12 @@ import com.tiesheng.web.pojos.dto.config.EnumTypeDTO;
import com.tiesheng.web.pojos.vo.ProcessDetailVo;
import com.tiesheng.web.service.CoreConfigService;
import com.tiesheng.web.service.CoreLogService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@RestController

View File

@@ -26,11 +26,11 @@ import com.tiesheng.web.service.CoreLogService;
import com.tiesheng.web.service.FileUploadService;
import com.tiesheng.web.service.imex.TsExportHandler;
import com.tiesheng.web.service.imex.TsImportHandler;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

View File

@@ -8,12 +8,12 @@ import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.PageDTO;
import com.tiesheng.web.pojos.dao.CoreLogApi;
import com.tiesheng.web.service.CoreLogService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**

View File

@@ -7,12 +7,12 @@ import com.tiesheng.login.pojos.dao.CoreLogLogin;
import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.PageDTO;
import com.tiesheng.web.service.CoreLogService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**

View File

@@ -7,12 +7,12 @@ import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.PageDTO;
import com.tiesheng.web.pojos.dao.CoreLogOperation;
import com.tiesheng.web.service.CoreLogService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**

View File

@@ -8,12 +8,12 @@ import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.util.pojos.PageDTO;
import com.tiesheng.web.pojos.dao.CoreLogProcess;
import com.tiesheng.web.service.CoreLogService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**

View File

@@ -1,6 +1,6 @@
package com.tiesheng.web.pojos.dto.config;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
public class ConfigSystemDTO {

View File

@@ -1,8 +1,7 @@
package com.tiesheng.web.pojos.imex;
import com.alibaba.fastjson.JSONObject;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
public class ExportDealDTO {

View File

@@ -1,8 +1,8 @@
package com.tiesheng.web.pojos.imex;
import com.alibaba.fastjson.JSONObject;
import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotEmpty;
public class ImportDealDTO {

View File

@@ -1,8 +1,6 @@
package com.tiesheng.web.pojos.imex;
import javax.validation.constraints.NotEmpty;
public class ImportInfoDTO {
@NotEmpty(message = "操作必须存在")
@@ -13,7 +11,8 @@ public class ImportInfoDTO {
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
/// ////////////////////////////////////////////////////////////////////////
public String getAction() {
return action;

View File

@@ -8,11 +8,10 @@ import com.tiesheng.web.mapper.CoreConfigEnumMapper;
import com.tiesheng.web.mapper.CoreConfigSystemMapper;
import com.tiesheng.web.pojos.dao.CoreConfigSystem;
import com.tiesheng.web.pojos.dto.config.ConfigSystemDTO;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author hao
*/

View File

@@ -5,12 +5,12 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.web.mapper.CoreLogApiMapper;
import com.tiesheng.web.pojos.dao.CoreLogApi;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import okhttp3.*;
import okio.Buffer;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.Objects;

View File

@@ -4,7 +4,6 @@ import cn.hutool.log.LogFactory;
import com.tiesheng.login.service.TsLoginConfigurer;
import com.tiesheng.util.exception.ApiRespEnum;
import com.tiesheng.util.pojos.ApiResp;
import com.tiesheng.web.pojos.dao.CoreConfigSystem;
import com.tiesheng.web.pojos.dto.config.ConfigSystemDTO;
import org.springframework.web.multipart.MultipartFile;