chore: Spring Boot 2.7.8 => 3.0.3
1.Spring Boot 2.7.8 => 3.0.3 2.Knife4j 适配 Spring Boot 3.x 3.ServletUtil => JakartaServletUtil 4.javax.* => jakarta.*
This commit is contained in:
parent
9bbff7f22c
commit
dea160a7b2
@ -130,12 +130,7 @@ limitations under the License.
|
||||
<!-- Knife4j(前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案) -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Doc OpenAPI(可以结合 Spring Boot 使用的,基于 OpenAPI3 的 API 文档生成工具) -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Redisson(不仅仅是一个 Redis Java 客户端) -->
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ -75,7 +75,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "分页查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping
|
||||
protected R<PageDataVO<V>> page(@Validated Q query, @Validated PageQuery pageQuery) {
|
||||
public R<PageDataVO<V>> page(@Validated Q query, @Validated PageQuery pageQuery) {
|
||||
this.checkPermission("list");
|
||||
PageDataVO<V> pageDataVO = baseService.page(query, pageQuery);
|
||||
return R.ok(pageDataVO);
|
||||
@ -93,7 +93,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "查询树列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/tree")
|
||||
protected R<List<Tree<Long>>> tree(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
public R<List<Tree<Long>>> tree(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
this.checkPermission("list");
|
||||
List<Tree<Long>> list = baseService.tree(query, sortQuery, false);
|
||||
return R.ok(list);
|
||||
@ -111,7 +111,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "查询列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
protected R<List<V>> list(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
public R<List<V>> list(@Validated Q query, @Validated SortQuery sortQuery) {
|
||||
this.checkPermission("list");
|
||||
List<V> list = baseService.list(query, sortQuery);
|
||||
return R.ok(list);
|
||||
@ -128,7 +128,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Parameter(name = "id", description = "ID", in = ParameterIn.PATH)
|
||||
@ResponseBody
|
||||
@GetMapping("/{id}")
|
||||
protected R<D> get(@PathVariable Long id) {
|
||||
public R<D> get(@PathVariable Long id) {
|
||||
this.checkPermission("list");
|
||||
D detail = baseService.get(id);
|
||||
return R.ok(detail);
|
||||
@ -144,7 +144,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "新增数据")
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
protected R<Long> add(@Validated @RequestBody C request) {
|
||||
public R<Long> add(@Validated @RequestBody C request) {
|
||||
this.checkPermission("add");
|
||||
Long id = baseService.add(request);
|
||||
return R.ok("新增成功", id);
|
||||
@ -162,7 +162,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "修改数据")
|
||||
@ResponseBody
|
||||
@PutMapping("/{id}")
|
||||
protected R update(@Validated @RequestBody C request, @PathVariable Long id) {
|
||||
public R update(@Validated @RequestBody C request, @PathVariable Long id) {
|
||||
this.checkPermission("update");
|
||||
baseService.update(request, id);
|
||||
return R.ok("修改成功");
|
||||
@ -179,7 +179,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Parameter(name = "ids", description = "ID 列表", in = ParameterIn.PATH)
|
||||
@ResponseBody
|
||||
@DeleteMapping("/{ids}")
|
||||
protected R delete(@PathVariable List<Long> ids) {
|
||||
public R delete(@PathVariable List<Long> ids) {
|
||||
this.checkPermission("delete");
|
||||
baseService.delete(ids);
|
||||
return R.ok("删除成功");
|
||||
@ -197,7 +197,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
*/
|
||||
@Operation(summary = "导出数据")
|
||||
@GetMapping("/export")
|
||||
protected void export(@Validated Q query, @Validated SortQuery sortQuery, HttpServletResponse response) {
|
||||
public void export(@Validated Q query, @Validated SortQuery sortQuery, HttpServletResponse response) {
|
||||
this.checkPermission("export");
|
||||
baseService.export(query, sortQuery, response);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import jakarta.validation.groups.Default;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -55,7 +56,14 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
|
||||
// 拼接路径前缀(合并了 @RequestMapping 的部分能力)
|
||||
String pathPrefix = crudRequestMapping.value();
|
||||
if (StrUtil.isNotBlank(pathPrefix)) {
|
||||
requestMappingInfo = RequestMappingInfo.paths(pathPrefix).build().combine(requestMappingInfo);
|
||||
/**
|
||||
* 问题:RequestMappingInfo.paths(pathPrefix)返回的RequestMappingInfo对象里pathPatternsCondition = null
|
||||
* 导致combine()方法抛出断言异常!
|
||||
* 修复: 创建options对象, 并设置PatternParser
|
||||
*/
|
||||
RequestMappingInfo.BuilderConfiguration options = new RequestMappingInfo.BuilderConfiguration();
|
||||
options.setPatternParser(PathPatternParser.defaultInstance);
|
||||
requestMappingInfo = RequestMappingInfo.paths(pathPrefix).options(options).build().combine(requestMappingInfo);
|
||||
}
|
||||
|
||||
// 过滤 API
|
||||
|
@ -18,9 +18,9 @@ package top.charles7c.cnadmin.common.handler;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.common.model.query;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Min;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.common.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -19,7 +19,7 @@ package top.charles7c.cnadmin.common.util;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -22,8 +22,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
|
@ -18,8 +18,8 @@ package top.charles7c.cnadmin.common.util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -18,14 +18,14 @@ package top.charles7c.cnadmin.common.util.helper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.constant.CacheConsts;
|
||||
import top.charles7c.cnadmin.common.model.dto.LogContext;
|
||||
@ -57,7 +57,7 @@ public class LoginHelper {
|
||||
|
||||
// 记录登录信息
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
loginUser.setClientIp(ServletUtil.getClientIP(request));
|
||||
loginUser.setClientIp(JakartaServletUtil.getClientIP(request));
|
||||
loginUser.setLocation(IpUtils.getCityInfo(loginUser.getClientIp()));
|
||||
loginUser.setBrowser(ServletUtils.getBrowser(request));
|
||||
LogContext logContext = LogContextHolder.get();
|
||||
|
@ -82,7 +82,7 @@ public class QueryHelper {
|
||||
* 查询数据类型
|
||||
*/
|
||||
private static <Q, R> void buildQuery(Q query, Field field, QueryWrapper<R> queryWrapper) {
|
||||
boolean accessible = field.isAccessible();
|
||||
boolean accessible = field.canAccess(null);
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
// 没有 @Query,直接返回
|
||||
|
@ -19,10 +19,10 @@ package top.charles7c.cnadmin.monitor.filter;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
@ -19,8 +19,8 @@ package top.charles7c.cnadmin.monitor.interceptor;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -41,7 +41,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.servlet.JakartaServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@ -215,13 +215,13 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
logDO.setRequestUrl(StrUtil.isBlank(request.getQueryString()) ? request.getRequestURL().toString()
|
||||
: request.getRequestURL().append("?").append(request.getQueryString()).toString());
|
||||
logDO.setRequestMethod(request.getMethod());
|
||||
logDO.setRequestHeaders(this.desensitize(ServletUtil.getHeaderMap(request)));
|
||||
logDO.setRequestHeaders(this.desensitize(JakartaServletUtil.getHeaderMap(request)));
|
||||
String requestBody = this.getRequestBody(request);
|
||||
if (StrUtil.isNotBlank(requestBody)) {
|
||||
logDO.setRequestBody(this.desensitize(
|
||||
JSONUtil.isTypeJSON(requestBody) ? JSONUtil.parseObj(requestBody) : ServletUtil.getParamMap(request)));
|
||||
JSONUtil.isTypeJSON(requestBody) ? JSONUtil.parseObj(requestBody) : JakartaServletUtil.getParamMap(request)));
|
||||
}
|
||||
logDO.setClientIp(ServletUtil.getClientIP(request));
|
||||
logDO.setClientIp(JakartaServletUtil.getClientIP(request));
|
||||
logDO.setLocation(IpUtils.getCityInfo(logDO.getClientIp()));
|
||||
logDO.setBrowser(ServletUtils.getBrowser(request));
|
||||
logDO.setCreateUser(ObjectUtil.defaultIfNull(logDO.getCreateUser(), LoginHelper.getUserId()));
|
||||
@ -243,7 +243,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
private void logResponse(LogDO logDO, HttpServletResponse response) {
|
||||
int status = response.getStatus();
|
||||
logDO.setStatusCode(status);
|
||||
logDO.setResponseHeaders(this.desensitize(ServletUtil.getHeadersMap(response)));
|
||||
logDO.setResponseHeaders(this.desensitize(JakartaServletUtil.getHeadersMap(response)));
|
||||
// 响应体(不记录非 JSON 响应数据)
|
||||
String responseBody = this.getResponseBody(response);
|
||||
if (StrUtil.isNotBlank(responseBody) && JSONUtil.isTypeJSON(responseBody)) {
|
||||
@ -328,7 +328,7 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
|
||||
// 2、检查是否需要记录内网 IP 操作
|
||||
boolean isInnerIp = IpUtils.isInnerIp(ServletUtil.getClientIP(request));
|
||||
boolean isInnerIp = IpUtils.isInnerIp(JakartaServletUtil.getClientIP(request));
|
||||
if (isInnerIp && Boolean.FALSE.equals(operationLogProperties.getIncludeInnerIp())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
@ -30,6 +30,7 @@ import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import top.charles7c.cnadmin.auth.config.satoken.properties.SecurityProperties;
|
||||
|
||||
/**
|
||||
* Sa-Token 配置
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.cnadmin.auth.config.satoken;
|
||||
package top.charles7c.cnadmin.auth.config.satoken.properties;
|
||||
|
||||
import lombok.Data;
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.auth.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.springdoc.api.annotations.ParameterObject;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.Query;
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,8 +18,8 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,8 +18,8 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,8 +18,8 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -19,7 +19,7 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -18,7 +18,7 @@ package top.charles7c.cnadmin.system.model.request;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@ -18,9 +18,9 @@ package top.charles7c.cnadmin.webapi.controller.common;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package top.charles7c.cnadmin.webapi.controller.system;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class UserController extends BaseController<UserService, UserVO, UserDeta
|
||||
|
||||
@Override
|
||||
@SaCheckPermission("system:user:add")
|
||||
protected R<Long> add(@Validated(BaseRequest.Add.class) @RequestBody UserRequest request) {
|
||||
public R<Long> add(@Validated(BaseRequest.Add.class) @RequestBody UserRequest request) {
|
||||
Long id = baseService.add(request);
|
||||
return R.ok(String.format("新增成功,请牢记默认密码:%s", SysConsts.DEFAULT_PASSWORD), id);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ spring:
|
||||
master:
|
||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:root}
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 从库配置(可配多个,构成多从)
|
||||
slave_1:
|
||||
@ -53,19 +53,20 @@ spring.liquibase:
|
||||
|
||||
--- ### Redis 单机配置
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl: false
|
||||
data:
|
||||
redis:
|
||||
# 地址
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
# 端口(默认 6379)
|
||||
port: ${REDIS_PORT:6379}
|
||||
# 密码(未设置密码时可为空或注释掉)
|
||||
# password: ${REDIS_PWD:123456}
|
||||
# 数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启 SSL
|
||||
ssl: false
|
||||
|
||||
--- ### 邮件配置
|
||||
spring:
|
||||
|
@ -195,3 +195,22 @@ thread-pool:
|
||||
queueCapacity: 128
|
||||
# 活跃时间
|
||||
keepAliveSeconds: 300
|
||||
|
||||
management:
|
||||
health:
|
||||
mail:
|
||||
# 临时关闭邮箱健康检查
|
||||
# 注: 邮箱参数没有正确配置会出现mail health异常
|
||||
enabled: false
|
||||
# redis:
|
||||
# # redis
|
||||
# enabled: false
|
||||
# mongo:
|
||||
# # 关闭mongodb健康检查
|
||||
# enabled: false
|
||||
# solr:
|
||||
# # 关闭solr健康检查
|
||||
# enabled: false
|
||||
# elasticsearch:
|
||||
# # 关闭es健康检查
|
||||
# enabled: false
|
45
pom.xml
45
pom.xml
@ -14,8 +14,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -38,7 +38,7 @@ limitations under the License.
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.8</version>
|
||||
<version>3.0.3</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
@ -54,17 +54,21 @@ limitations under the License.
|
||||
<easyexcel.version>3.2.0</easyexcel.version>
|
||||
<ip2region.version>2.7.6</ip2region.version>
|
||||
<knife4j.version>4.0.0</knife4j.version>
|
||||
<redisson.version>3.19.0</redisson.version>
|
||||
<redisson.version>3.19.2</redisson.version>
|
||||
<easy-captcha.version>1.6.2</easy-captcha.version>
|
||||
<hutool.version>5.8.11</hutool.version>
|
||||
<hutool.version>5.8.15</hutool.version>
|
||||
<okhttp.version>4.10.0</okhttp.version>
|
||||
|
||||
<!-- ### 基础环境相关 ### -->
|
||||
<revision>0.0.1-SNAPSHOT</revision>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>3.0.0</revision>
|
||||
<spotless.version>2.28.0</spotless.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- <skipTests>true</skipTests>-->
|
||||
<!-- ### 下面的这些属性spring-boot-starter-parent里<properties>已经有定义, 无需重复定义 ### -->
|
||||
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
|
||||
<!-- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>-->
|
||||
<!-- <java.version>17</java.version>-->
|
||||
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
||||
<!-- <maven.compiler.target>17</maven.compiler.target>-->
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
@ -146,6 +150,12 @@ limitations under the License.
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>${easyexcel.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方封装 Ip2region(离线 IP 数据管理框架和定位库,支持亿级别的数据段,10 微秒级别的查询性能,提供了许多主流编程语言的 xdb 数据管理引擎的实现) -->
|
||||
@ -185,6 +195,13 @@ limitations under the License.
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- OkHttp(网络请求库)-->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ################ 本项目子模块相关 ################ -->
|
||||
<!-- API 模块(存放 Controller 层代码,打包部署的模块) -->
|
||||
<dependency>
|
||||
@ -291,8 +308,8 @@ limitations under the License.
|
||||
<!-- 远程仓库配置:阿里云 Maven 中央仓库(公共代理仓库,Central 仓和 JCenter 仓的聚合仓,帮助研发人员提高研发生产效率,使用阿里云 Maven 中央仓库作为下载源,速度更快更稳定) -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<name>aliyun maven</name>
|
||||
<id>aliyun-public</id>
|
||||
<name>aliyun maven public</name>
|
||||
<url>https://maven.aliyun.com/repository/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
@ -302,8 +319,8 @@ limitations under the License.
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun maven</name>
|
||||
<id>aliyun-public</id>
|
||||
<name>aliyun maven public</name>
|
||||
<url>https://maven.aliyun.com/repository/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
|
Loading…
Reference in New Issue
Block a user