update 升级 jdk 17

update springboot 3.0.7
update springcloud 2022.0.2
update springcloud-alibaba 2022.0.0.0-RC2
update springboot-admin 3.0.4
update springdoc 2.1.0
update dynamic-ds 3.6.1
add flatten-maven-plugin
update javax -> jakarta
...........未完待续
2.X
疯狂的狮子li 2 years ago
parent d3130cf055
commit 55c3e7687b

@ -106,14 +106,15 @@ spring:
# dashboard: localhost:8718 # dashboard: localhost:8718
# redis通用配置 子服务可以自行配置进行覆盖 # redis通用配置 子服务可以自行配置进行覆盖
redis: data:
host: localhost redis:
port: 6379 host: localhost
# 密码(如没有密码请注释掉) port: 6379
# password: # 密码(如没有密码请注释掉)
database: 0 # password:
timeout: 10s database: 0
ssl: false timeout: 10s
ssl: false
# redisson 配置 # redisson 配置
redisson: redisson:
@ -265,10 +266,6 @@ swagger:
type: APIKEY type: APIKEY
in: HEADER in: HEADER
name: ${sa-token.token-name} name: ${sa-token.token-name}
# 服务文档路径映射 参考 gateway router 配置
# 默认为服务名去除前缀转换为path 此处填特殊的配置
service-mapping:
ruoyi-gen: /code
springdoc: springdoc:
api-docs: api-docs:

@ -16,18 +16,19 @@
<revision>2.0.0-SNAPSHOT</revision> <revision>2.0.0-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>17</java.version>
<spring-boot.version>2.7.11</spring-boot.version> <spring-boot.version>3.0.7</spring-boot.version>
<spring-cloud.version>2021.0.7</spring-cloud.version> <spring-cloud.version>2022.0.2</spring-cloud.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version> <spring-boot-admin.version>3.0.4</spring-boot-admin.version>
<spring-boot.mybatis>2.2.2</spring-boot.mybatis> <spring-boot.mybatis>2.2.2</spring-boot.mybatis>
<mybatis.version>3.5.10</mybatis.version> <mybatis.version>3.5.10</mybatis.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version> <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version> <p6spy.version>3.9.1</p6spy.version>
<dynamic-ds.version>3.5.2</dynamic-ds.version> <dynamic-ds.version>3.6.1</dynamic-ds.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<swagger.core.version>2.2.8</swagger.core.version> <swagger.core.version>2.2.9</swagger.core.version>
<springdoc.version>1.6.15</springdoc.version> <springdoc.version>2.1.0</springdoc.version>
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
<poi.version>5.2.3</poi.version> <poi.version>5.2.3</poi.version>
<easyexcel.version>3.2.1</easyexcel.version> <easyexcel.version>3.2.1</easyexcel.version>
<hutool.version>5.8.18</hutool.version> <hutool.version>5.8.18</hutool.version>
@ -42,7 +43,7 @@
<skywalking-toolkit.version>8.14.0</skywalking-toolkit.version> <skywalking-toolkit.version>8.14.0</skywalking-toolkit.version>
<bouncycastle.version>1.72</bouncycastle.version> <bouncycastle.version>1.72</bouncycastle.version>
<alibaba-ttl.version>2.14.2</alibaba-ttl.version> <alibaba-ttl.version>2.14.2</alibaba-ttl.version>
<mapstruct-plus.version>1.2.1</mapstruct-plus.version> <mapstruct-plus.version>1.2.3</mapstruct-plus.version>
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version> <mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
<!-- 离线IP地址定位库 --> <!-- 离线IP地址定位库 -->
<ip2region.version>2.7.0</ip2region.version> <ip2region.version>2.7.0</ip2region.version>
@ -59,6 +60,11 @@
<!-- SMS 配置 --> <!-- SMS 配置 -->
<aliyun.sms.version>2.0.23</aliyun.sms.version> <aliyun.sms.version>2.0.23</aliyun.sms.version>
<tencent.sms.version>3.1.687</tencent.sms.version> <tencent.sms.version>3.1.687</tencent.sms.version>
<!-- 插件版本 -->
<maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
</properties> </properties>
<profiles> <profiles>
@ -155,7 +161,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${satoken.version}</version> <version>${satoken.version}</version>
</dependency> </dependency>
@ -198,14 +204,14 @@
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId> <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>${springdoc.version}</version> <version>${springdoc.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>com.github.therapi</groupId>
<artifactId>springdoc-openapi-javadoc</artifactId> <artifactId>therapi-runtime-javadoc</artifactId>
<version>${springdoc.version}</version> <version>${therapi-javadoc.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@ -372,8 +378,6 @@
<version>${mapstruct-plus.version}</version> <version>${mapstruct-plus.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -397,7 +401,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version> <version>${maven-compiler-plugin.verison}</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
@ -435,7 +439,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version> <version>${maven-surefire-plugin.version}</version>
<configuration> <configuration>
<argLine>-Dfile.encoding=UTF-8</argLine> <argLine>-Dfile.encoding=UTF-8</argLine>
<!-- 根据打包环境执行对应的@Tag测试方法 --> <!-- 根据打包环境执行对应的@Tag测试方法 -->
@ -444,6 +448,32 @@
<excludedGroups>exclude</excludedGroups> <excludedGroups>exclude</excludedGroups>
</configuration> </configuration>
</plugin> </plugin>
<!-- 统一版本号管理 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>

@ -6,9 +6,9 @@ import lombok.NoArgsConstructor;
import org.dromara.common.core.constant.UserConstants; import org.dromara.common.core.constant.UserConstants;
import org.dromara.common.core.xss.Xss; import org.dromara.common.core.xss.Xss;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;

@ -97,7 +97,6 @@ public class LoginUser implements Serializable {
/** /**
* *
*/ */
@JsonIgnore
private String password; private String password;
/** /**

@ -24,8 +24,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;

@ -2,8 +2,8 @@ package org.dromara.auth.form;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
/** /**
* *

@ -5,7 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
/** /**
* *

@ -2,7 +2,7 @@ package org.dromara.auth.form;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
/** /**
* *

@ -15,11 +15,11 @@
<properties> <properties>
<revision>2.0.0-SNAPSHOT</revision> <revision>2.0.0-SNAPSHOT</revision>
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2022.0.0.0-RC2</spring-cloud-alibaba.version>
<sentinel.version>1.8.6</sentinel.version> <sentinel.version>1.8.6</sentinel.version>
<seata.version>1.6.1</seata.version> <seata.version>1.6.1</seata.version>
<nacos.client.version>2.2.1</nacos.client.version> <nacos.client.version>2.2.1</nacos.client.version>
<dubbo.version>3.1.8</dubbo.version> <dubbo.version>3.2.1</dubbo.version>
<spring.context.support.version>1.0.11</spring.context.support.version> <spring.context.support.version>1.0.11</spring.context.support.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>

@ -45,22 +45,16 @@
<artifactId>spring-boot-starter-validation</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
</dependency> </dependency>
<!-- Jaxb -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- Apache Lang3 --> <!-- Apache Lang3 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- Java Servlet --> <!-- servlet包 -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>jakarta.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>jakarta.servlet-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>

@ -8,6 +8,7 @@ import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport; import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
@ -22,7 +23,7 @@ import java.util.concurrent.*;
@Slf4j @Slf4j
@EnableAsync(proxyTargetClass = true) @EnableAsync(proxyTargetClass = true)
@AutoConfiguration @AutoConfiguration
public class AsyncConfig extends AsyncConfigurerSupport { public class AsyncConfig implements AsyncConfigurer {
private static final int CORE_POOL_SIZE = 10; private static final int CORE_POOL_SIZE = 10;

@ -7,7 +7,7 @@ import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import javax.validation.Validator; import jakarta.validation.Validator;
import java.util.Properties; import java.util.Properties;
/** /**

@ -1,6 +1,7 @@
package org.dromara.common.core.utils; package org.dromara.common.core.utils;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.extra.servlet.JakartaServletUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import org.dromara.common.core.constant.Constants; import org.dromara.common.core.constant.Constants;
@ -12,10 +13,10 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletRequest; import jakarta.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
@ -32,7 +33,7 @@ import java.util.Map;
* @author ruoyi * @author ruoyi
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ServletUtils extends ServletUtil { public class ServletUtils extends JakartaServletUtil {
/** /**
* String * String

@ -3,9 +3,9 @@ package org.dromara.common.core.utils;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.ConstraintViolation; import jakarta.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import jakarta.validation.ConstraintViolationException;
import javax.validation.Validator; import jakarta.validation.Validator;
import java.util.Set; import java.util.Set;
/** /**

@ -4,7 +4,7 @@ import cn.hutool.core.io.FileUtil;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

@ -1,7 +1,7 @@
package org.dromara.common.core.xss; package org.dromara.common.core.xss;
import javax.validation.Constraint; import jakarta.validation.Constraint;
import javax.validation.Payload; import jakarta.validation.Payload;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;

@ -3,8 +3,8 @@ package org.dromara.common.core.xss;
import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.ReUtil;
import cn.hutool.http.HtmlUtil; import cn.hutool.http.HtmlUtil;
import javax.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
/** /**
* xss * xss

@ -25,12 +25,17 @@
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId> <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>com.github.therapi</groupId>
<artifactId>springdoc-openapi-javadoc</artifactId> <artifactId>therapi-runtime-javadoc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

@ -8,12 +8,15 @@ import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityRequirement;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springdoc.core.*; import org.springdoc.core.configuration.SpringDocConfiguration;
import org.springdoc.core.customizers.OpenApiBuilderCustomizer; import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
import org.springdoc.core.customizers.OpenApiCustomiser; import org.springdoc.core.customizers.OpenApiCustomizer;
import org.springdoc.core.customizers.ServerBaseUrlCustomizer; import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.providers.JavadocProvider; import org.springdoc.core.providers.JavadocProvider;
import org.springframework.beans.factory.annotation.Value; import org.springdoc.core.service.OpenAPIService;
import org.springdoc.core.service.SecurityService;
import org.springdoc.core.utils.PropertyResolverUtils;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -21,7 +24,10 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
/** /**
* Swagger * Swagger
@ -34,16 +40,11 @@ import java.util.*;
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
public class SwaggerAutoConfiguration { public class SwaggerAutoConfiguration {
private final SwaggerProperties swaggerProperties;
private final ServerProperties serverProperties; private final ServerProperties serverProperties;
@Value("${spring.application.name}")
private String appName;
@Bean @Bean
@ConditionalOnMissingBean(OpenAPI.class) @ConditionalOnMissingBean(OpenAPI.class)
public OpenAPI openApi() { public OpenAPI openApi(SwaggerProperties swaggerProperties) {
OpenAPI openApi = new OpenAPI(); OpenAPI openApi = new OpenAPI();
// 文档基本信息 // 文档基本信息
SwaggerProperties.InfoProperties infoProperties = swaggerProperties.getInfo(); SwaggerProperties.InfoProperties infoProperties = swaggerProperties.getInfo();
@ -90,22 +91,13 @@ public class SwaggerAutoConfiguration {
* OpenApi * OpenApi
*/ */
@Bean @Bean
public OpenApiCustomiser openApiCustomiser() { public OpenApiCustomizer openApiCustomizer() {
// 如果服务的自定义 Path 不存在 则采用默认去除前缀当 Path
Map<String, String> serviceMapping = swaggerProperties.getServiceMapping();
String appPath;
if (serviceMapping.containsKey(appName)) {
appPath = serviceMapping.get(appName);
} else {
appPath = "/" + StringUtils.substring(appName, appName.indexOf("-") + 1);
}
String contextPath = serverProperties.getServlet().getContextPath(); String contextPath = serverProperties.getServlet().getContextPath();
String finalContextPath; String finalContextPath;
if (StringUtils.isBlank(contextPath) || "/".equals(contextPath)) { if (StringUtils.isBlank(contextPath) || "/".equals(contextPath)) {
finalContextPath = appPath; finalContextPath = "";
} else { } else {
finalContextPath = appPath + contextPath; finalContextPath = contextPath;
} }
// 对所有路径增加前置上下文路径 // 对所有路径增加前置上下文路径
return openApi -> { return openApi -> {
@ -114,7 +106,7 @@ public class SwaggerAutoConfiguration {
return; return;
} }
PlusPaths newPaths = new PlusPaths(); PlusPaths newPaths = new PlusPaths();
oldPaths.forEach((k,v) -> newPaths.addPathItem(finalContextPath + k, v)); oldPaths.forEach((k, v) -> newPaths.addPathItem(finalContextPath + k, v));
openApi.setPaths(newPaths); openApi.setPaths(newPaths);
}; };
} }

@ -11,7 +11,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* swagger * swagger
@ -51,12 +50,6 @@ public class SwaggerProperties {
@NestedConfigurationProperty @NestedConfigurationProperty
private Components components = null; private Components components = null;
/**
* gateway router
* path
*/
private Map<String, String> serviceMapping = null;
/** /**
* <p> * <p>
* *

@ -9,16 +9,15 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.Paths; import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.oas.models.tags.Tag; import io.swagger.v3.oas.models.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.OpenAPIService;
import org.springdoc.core.PropertyResolverUtils;
import org.springdoc.core.SecurityService;
import org.springdoc.core.SpringDocConfigProperties;
import org.springdoc.core.customizers.OpenApiBuilderCustomizer; import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
import org.springdoc.core.customizers.ServerBaseUrlCustomizer; import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.providers.JavadocProvider; import org.springdoc.core.providers.JavadocProvider;
import org.springdoc.core.service.OpenAPIService;
import org.springdoc.core.service.SecurityService;
import org.springdoc.core.utils.PropertyResolverUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -34,18 +33,14 @@ import java.util.stream.Stream;
* openapi * openapi
* 使 * 使
*/ */
@Slf4j
@SuppressWarnings("all") @SuppressWarnings("all")
public class OpenApiHandler extends OpenAPIService { public class OpenApiHandler extends OpenAPIService {
/** /**
* The constant LOGGER. * The Basic error controller.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(OpenAPIService.class);
/**
* The Context.
*/ */
private ApplicationContext context; private static Class<?> basicErrorController;
/** /**
* The Security parser. * The Security parser.
@ -77,55 +72,40 @@ public class OpenApiHandler extends OpenAPIService {
*/ */
private final SpringDocConfigProperties springDocConfigProperties; private final SpringDocConfigProperties springDocConfigProperties;
/**
* The Open api.
*/
private OpenAPI openAPI;
/** /**
* The Cached open api map. * The Cached open api map.
*/ */
private final Map<String, OpenAPI> cachedOpenAPI = new HashMap<>(); private final Map<String, OpenAPI> cachedOpenAPI = new HashMap<>();
/** /**
* The Is servers present. * The Property resolver utils.
*/ */
private boolean isServersPresent; private final PropertyResolverUtils propertyResolverUtils;
/** /**
* The Server base url. * The javadoc provider.
*/ */
private String serverBaseUrl; private final Optional<JavadocProvider> javadocProvider;
/** /**
* The Property resolver utils. * The Context.
*/ */
private final PropertyResolverUtils propertyResolverUtils; private ApplicationContext context;
/** /**
* The javadoc provider. * The Open api.
*/ */
private final Optional<JavadocProvider> javadocProvider; private OpenAPI openAPI;
/** /**
* The Basic error controller. * The Is servers present.
*/ */
private static Class<?> basicErrorController; private boolean isServersPresent;
static { /**
try { * The Server base url.
//spring-boot 2 */
basicErrorController = Class.forName("org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController"); private String serverBaseUrl;
} catch (ClassNotFoundException e) {
//spring-boot 1
try {
basicErrorController = Class.forName("org.springframework.boot.autoconfigure.web.BasicErrorController");
} catch (ClassNotFoundException classNotFoundException) {
//Basic error controller class not found
LOGGER.trace(classNotFoundException.getMessage());
}
}
}
/** /**
* Instantiates a new Open api builder. * Instantiates a new Open api builder.

@ -58,7 +58,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot3-starter</artifactId>
</dependency> </dependency>
<!-- Sa-Token 整合 Dubbo --> <!-- Sa-Token 整合 Dubbo -->

@ -11,8 +11,8 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.json.utils.JsonUtils; import org.dromara.common.json.utils.JsonUtils;
import javax.validation.ConstraintViolation; import jakarta.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import jakarta.validation.ConstraintViolationException;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;

@ -20,8 +20,8 @@ import org.dromara.common.excel.core.ExcelResult;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.servlet.ServletOutputStream; import jakarta.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;

@ -20,8 +20,8 @@ import org.dromara.common.redis.utils.RedisUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.time.Duration; import java.time.Duration;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;

@ -22,8 +22,8 @@ import org.springframework.http.HttpMethod;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;

@ -16,7 +16,7 @@ import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
/** /**
* *

@ -2,7 +2,7 @@ package org.dromara.common.log.event;
import lombok.Data; import lombok.Data;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import java.io.Serializable; import java.io.Serializable;
/** /**

@ -23,7 +23,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>jakarta.mail</artifactId> <artifactId>jakarta.mail</artifactId>
</dependency> </dependency>

@ -0,0 +1,37 @@
package org.dromara.common.mail.config;
import org.dromara.common.mail.config.properties.MailProperties;
import org.dromara.common.mail.utils.MailAccount;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
/**
* JavaMail
*
* @author Michelle.Chung
*/
@AutoConfiguration
@EnableConfigurationProperties(MailProperties.class)
public class MailConfig {
@Bean
@ConditionalOnProperty(value = "mail.enabled", havingValue = "true")
public MailAccount mailAccount(MailProperties mailProperties) {
MailAccount account = new MailAccount();
account.setHost(mailProperties.getHost());
account.setPort(mailProperties.getPort());
account.setAuth(mailProperties.getAuth());
account.setFrom(mailProperties.getFrom());
account.setUser(mailProperties.getUser());
account.setPass(mailProperties.getPass());
account.setSocketFactoryPort(mailProperties.getPort());
account.setStarttlsEnable(mailProperties.getStarttlsEnable());
account.setSslEnable(mailProperties.getSslEnable());
account.setTimeout(mailProperties.getTimeout());
account.setConnectionTimeout(mailProperties.getConnectionTimeout());
return account;
}
}

@ -0,0 +1,46 @@
package org.dromara.common.mail.utils;
import cn.hutool.core.io.IORuntimeException;
/**
* {@link MailAccount#MAIL_SETTING_PATHS}
*
* @author looly
*/
public enum GlobalMailAccount {
INSTANCE;
private final MailAccount mailAccount;
/**
*
*/
GlobalMailAccount() {
mailAccount = createDefaultAccount();
}
/**
*
*
* @return
*/
public MailAccount getAccount() {
return this.mailAccount;
}
/**
*
*
* @return MailAccount
*/
private MailAccount createDefaultAccount() {
for (String mailSettingPath : MailAccount.MAIL_SETTING_PATHS) {
try {
return new MailAccount(mailSettingPath);
} catch (IORuntimeException ignore) {
//ignore
}
}
return null;
}
}

@ -0,0 +1,108 @@
package org.dromara.common.mail.utils;
import cn.hutool.core.util.ArrayUtil;
import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeUtility;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
*
*
* @author looly
* @since 3.2.3
*/
public class InternalMailUtil {
/**
* {@link InternetAddress}<br>
*
*
* @param addrStrs
* @param charset
* @return
* @since 4.0.3
*/
public static InternetAddress[] parseAddressFromStrs(String[] addrStrs, Charset charset) {
final List<InternetAddress> resultList = new ArrayList<>(addrStrs.length);
InternetAddress[] addrs;
for (String addrStr : addrStrs) {
addrs = parseAddress(addrStr, charset);
if (ArrayUtil.isNotEmpty(addrs)) {
Collections.addAll(resultList, addrs);
}
}
return resultList.toArray(new InternetAddress[0]);
}
/**
*
*
* @param address
* @param charset {@code null}使
* @return
*/
public static InternetAddress parseFirstAddress(String address, Charset charset) {
final InternetAddress[] internetAddresses = parseAddress(address, charset);
if (ArrayUtil.isEmpty(internetAddresses)) {
try {
return new InternetAddress(address);
} catch (AddressException e) {
throw new MailException(e);
}
}
return internetAddresses[0];
}
/**
* <br>
* 使" "","";"
*
* @param address
* @param charset {@code null}使
* @return
*/
public static InternetAddress[] parseAddress(String address, Charset charset) {
InternetAddress[] addresses;
try {
addresses = InternetAddress.parse(address);
} catch (AddressException e) {
throw new MailException(e);
}
//编码用户名
if (ArrayUtil.isNotEmpty(addresses)) {
final String charsetStr = null == charset ? null : charset.name();
for (InternetAddress internetAddress : addresses) {
try {
internetAddress.setPersonal(internetAddress.getPersonal(), charsetStr);
} catch (UnsupportedEncodingException e) {
throw new MailException(e);
}
}
}
return addresses;
}
/**
* <br>
*
*
* @param text
* @param charset
* @return
*/
public static String encodeText(String text, Charset charset) {
try {
return MimeUtility.encodeText(text, charset.name(), null);
} catch (UnsupportedEncodingException e) {
// ignore
}
return text;
}
}

@ -0,0 +1,483 @@
package org.dromara.common.mail.utils;
import cn.hutool.core.builder.Builder;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import jakarta.activation.DataHandler;
import jakarta.activation.DataSource;
import jakarta.activation.FileDataSource;
import jakarta.activation.FileTypeMap;
import jakarta.mail.*;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMessage;
import jakarta.mail.internet.MimeMultipart;
import jakarta.mail.internet.MimeUtility;
import jakarta.mail.util.ByteArrayDataSource;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Date;
/**
*
*
* @author looly
* @since 3.2.0
*/
public class Mail implements Builder<MimeMessage> {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
private final MailAccount mailAccount;
/**
*
*/
private String[] tos;
/**
* carbon copy
*/
private String[] ccs;
/**
* blind carbon copy
*/
private String[] bccs;
/**
* (reply-to)
*/
private String[] reply;
/**
*
*/
private String title;
/**
*
*/
private String content;
/**
* HTML
*/
private boolean isHtml;
/**
*
*/
private final Multipart multipart = new MimeMultipart();
/**
* 使false
*/
private boolean useGlobalSession = false;
/**
* debugdebug
*/
private PrintStream debugOutput;
/**
*
*
* @param mailAccount
* @return Mail
*/
public static Mail create(MailAccount mailAccount) {
return new Mail(mailAccount);
}
/**
* 使
*
* @return Mail
*/
public static Mail create() {
return new Mail();
}
// --------------------------------------------------------------- Constructor start
/**
* 使
*/
public Mail() {
this(GlobalMailAccount.INSTANCE.getAccount());
}
/**
*
*
* @param mailAccount null使
*/
public Mail(MailAccount mailAccount) {
mailAccount = (null != mailAccount) ? mailAccount : GlobalMailAccount.INSTANCE.getAccount();
this.mailAccount = mailAccount.defaultIfEmpty();
}
// --------------------------------------------------------------- Constructor end
// --------------------------------------------------------------- Getters and Setters start
/**
*
*
* @param tos
* @return this
* @see #setTos(String...)
*/
public Mail to(String... tos) {
return setTos(tos);
}
/**
*
*
* @param tos
* @return this
*/
public Mail setTos(String... tos) {
this.tos = tos;
return this;
}
/**
* carbon copy
*
* @param ccs
* @return this
* @since 4.0.3
*/
public Mail setCcs(String... ccs) {
this.ccs = ccs;
return this;
}
/**
* blind carbon copy
*
* @param bccs
* @return this
* @since 4.0.3
*/
public Mail setBccs(String... bccs) {
this.bccs = bccs;
return this;
}
/**
* (reply-to)
*
* @param reply (reply-to)
* @return this
* @since 4.6.0
*/
public Mail setReply(String... reply) {
this.reply = reply;
return this;
}
/**
*
*
* @param title
* @return this
*/
public Mail setTitle(String title) {
this.title = title;
return this;
}
/**
* <br>
* HTML{@link #setHtml(boolean)} HTML
*
* @param content
* @return this
*/
public Mail setContent(String content) {
this.content = content;
return this;
}
/**
* HTML
*
* @param isHtml HTML
* @return this
*/
public Mail setHtml(boolean isHtml) {
this.isHtml = isHtml;
return this;
}
/**
*
*
* @param content
* @param isHtml HTML
* @return this
*/
public Mail setContent(String content, boolean isHtml) {
setContent(content);
return setHtml(isHtml);
}
/**
* cidcid
*
* @param files
* @return this
*/
public Mail setFiles(File... files) {
if (ArrayUtil.isEmpty(files)) {
return this;
}
final DataSource[] attachments = new DataSource[files.length];
for (int i = 0; i < files.length; i++) {
attachments[i] = new FileDataSource(files[i]);
}
return setAttachments(attachments);
}
/**
* 使{@link DataSource} 使{@link FileDataSource}
*
* @param attachments
* @return this
* @since 4.0.9
*/
public Mail setAttachments(DataSource... attachments) {
if (ArrayUtil.isNotEmpty(attachments)) {
final Charset charset = this.mailAccount.getCharset();
MimeBodyPart bodyPart;
String nameEncoded;
try {
for (DataSource attachment : attachments) {
bodyPart = new MimeBodyPart();
bodyPart.setDataHandler(new DataHandler(attachment));
nameEncoded = attachment.getName();
if (this.mailAccount.isEncodefilename()) {
nameEncoded = InternalMailUtil.encodeText(nameEncoded, charset);
}
// 普通附件文件名
bodyPart.setFileName(nameEncoded);
if (StrUtil.startWith(attachment.getContentType(), "image/")) {
// 图片附件,用于正文中引用图片
bodyPart.setContentID(nameEncoded);
}
this.multipart.addBodyPart(bodyPart);
}
} catch (MessagingException e) {
throw new MailException(e);
}
}
return this;
}
/**
* "image/jpeg"
*
* @param cid cid:${cid}
* @param imageStream
* @return this
* @since 4.6.3
*/
public Mail addImage(String cid, InputStream imageStream) {
return addImage(cid, imageStream, null);
}
/**
*
*
* @param cid cid:${cid}
* @param imageStream
* @param contentType null"image/jpeg"
* @return this
* @since 4.6.3
*/
public Mail addImage(String cid, InputStream imageStream, String contentType) {
ByteArrayDataSource imgSource;
try {
imgSource = new ByteArrayDataSource(imageStream, ObjectUtil.defaultIfNull(contentType, "image/jpeg"));
} catch (IOException e) {
throw new IORuntimeException(e);
}
imgSource.setName(cid);
return setAttachments(imgSource);
}
/**
*
*
* @param cid cid:${cid}
* @param imageFile
* @return this
* @since 4.6.3
*/
public Mail addImage(String cid, File imageFile) {
InputStream in = null;
try {
in = FileUtil.getInputStream(imageFile);
return addImage(cid, in, FileTypeMap.getDefaultFileTypeMap().getContentType(imageFile));
} finally {
IoUtil.close(in);
}
}
/**
*
*
* @param charset
* @return this
* @see MailAccount#setCharset(Charset)
*/
public Mail setCharset(Charset charset) {
this.mailAccount.setCharset(charset);
return this;
}
/**
* 使true
*
* @param isUseGlobalSession 使true
* @return this
* @since 4.0.2
*/
public Mail setUseGlobalSession(boolean isUseGlobalSession) {
this.useGlobalSession = isUseGlobalSession;
return this;
}
/**
* debugdebug
*
* @param debugOutput debug
* @return this
* @since 5.5.6
*/
public Mail setDebugOutput(PrintStream debugOutput) {
this.debugOutput = debugOutput;
return this;
}
// --------------------------------------------------------------- Getters and Setters end
@Override
public MimeMessage build() {
try {
return buildMsg();
} catch (MessagingException e) {
throw new MailException(e);
}
}
/**
*
*
* @return message-id
* @throws MailException
*/
public String send() throws MailException {
try {
return doSend();
} catch (MessagingException e) {
if (e instanceof SendFailedException) {
// 当地址无效时,显示更加详细的无效地址信息
final Address[] invalidAddresses = ((SendFailedException) e).getInvalidAddresses();
final String msg = StrUtil.format("Invalid Addresses: {}", ArrayUtil.toString(invalidAddresses));
throw new MailException(msg, e);
}
throw new MailException(e);
}
}
// --------------------------------------------------------------- Private method start
/**
*
*
* @return message-id
* @throws MessagingException
*/
private String doSend() throws MessagingException {
final MimeMessage mimeMessage = buildMsg();
Transport.send(mimeMessage);
return mimeMessage.getMessageID();
}
/**
*
*
* @return {@link MimeMessage}
* @throws MessagingException
*/
private MimeMessage buildMsg() throws MessagingException {
final Charset charset = this.mailAccount.getCharset();
final MimeMessage msg = new MimeMessage(getSession());
// 发件人
final String from = this.mailAccount.getFrom();
if (StrUtil.isEmpty(from)) {
// 用户未提供发送方则从Session中自动获取
msg.setFrom();
} else {
msg.setFrom(InternalMailUtil.parseFirstAddress(from, charset));
}
// 标题
msg.setSubject(this.title, (null == charset) ? null : charset.name());
// 发送时间
msg.setSentDate(new Date());
// 内容和附件
msg.setContent(buildContent(charset));
// 收件人
msg.setRecipients(MimeMessage.RecipientType.TO, InternalMailUtil.parseAddressFromStrs(this.tos, charset));
// 抄送人
if (ArrayUtil.isNotEmpty(this.ccs)) {
msg.setRecipients(MimeMessage.RecipientType.CC, InternalMailUtil.parseAddressFromStrs(this.ccs, charset));
}
// 密送人
if (ArrayUtil.isNotEmpty(this.bccs)) {
msg.setRecipients(MimeMessage.RecipientType.BCC, InternalMailUtil.parseAddressFromStrs(this.bccs, charset));
}
// 回复地址(reply-to)
if (ArrayUtil.isNotEmpty(this.reply)) {
msg.setReplyTo(InternalMailUtil.parseAddressFromStrs(this.reply, charset));
}
return msg;
}
/**
*
*
* @param charset {@code null}使{@link MimeUtility#getDefaultJavaCharset()}
* @return
* @throws MessagingException
*/
private Multipart buildContent(Charset charset) throws MessagingException {
final String charsetStr = null != charset ? charset.name() : MimeUtility.getDefaultJavaCharset();
// 正文
final MimeBodyPart body = new MimeBodyPart();
body.setContent(content, StrUtil.format("text/{}; charset={}", isHtml ? "html" : "plain", charsetStr));
this.multipart.addBodyPart(body);
return this.multipart;
}
/**
* <br>
*
*
* @return {@link Session}
*/
private Session getSession() {
final Session session = MailUtils.getSession(this.mailAccount, this.useGlobalSession);
if (null != this.debugOutput) {
session.setDebugOut(debugOutput);
}
return session;
}
// --------------------------------------------------------------- Private method end
}

@ -0,0 +1,659 @@
package org.dromara.common.mail.utils;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.setting.Setting;
import java.io.Serial;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
*
*
* @author Luxiaolei
*/
public class MailAccount implements Serializable {
@Serial
private static final long serialVersionUID = -6937313421815719204L;
private static final String MAIL_PROTOCOL = "mail.transport.protocol";
private static final String SMTP_HOST = "mail.smtp.host";
private static final String SMTP_PORT = "mail.smtp.port";
private static final String SMTP_AUTH = "mail.smtp.auth";
private static final String SMTP_TIMEOUT = "mail.smtp.timeout";
private static final String SMTP_CONNECTION_TIMEOUT = "mail.smtp.connectiontimeout";
private static final String SMTP_WRITE_TIMEOUT = "mail.smtp.writetimeout";
// SSL
private static final String STARTTLS_ENABLE = "mail.smtp.starttls.enable";
private static final String SSL_ENABLE = "mail.smtp.ssl.enable";
private static final String SSL_PROTOCOLS = "mail.smtp.ssl.protocols";
private static final String SOCKET_FACTORY = "mail.smtp.socketFactory.class";
private static final String SOCKET_FACTORY_FALLBACK = "mail.smtp.socketFactory.fallback";
private static final String SOCKET_FACTORY_PORT = "smtp.socketFactory.port";
// System Properties
private static final String SPLIT_LONG_PARAMS = "mail.mime.splitlongparameters";
//private static final String ENCODE_FILE_NAME = "mail.mime.encodefilename";
//private static final String CHARSET = "mail.mime.charset";
// 其他
private static final String MAIL_DEBUG = "mail.debug";
public static final String[] MAIL_SETTING_PATHS = new String[]{"config/mail.setting", "config/mailAccount.setting", "mail.setting"};
/**
* SMTP
*/
private String host;
/**
* SMTP
*/
private Integer port;
/**
*
*/
private Boolean auth;
/**
*
*/
private String user;
/**
*
*/
private String pass;
/**
* RFC-822
*/
private String from;
/**
*
*/
private boolean debug;
/**
*
*/
private Charset charset = CharsetUtil.CHARSET_UTF_8;
/**
* false
*/
private boolean splitlongparameters = false;
/**
* 使{@link #charset} {@code true}
*/
private boolean encodefilename = true;
/**
* 使 STARTTLSSTARTTLSTLSSSL 使
*/
private boolean starttlsEnable = false;
/**
* 使 SSL
*/
private Boolean sslEnable;
/**
* SSL
*/
private String sslProtocols;
/**
* javax.net.SocketFactory,SMTP
*/
private String socketFactoryClass = "javax.net.ssl.SSLSocketFactory";
/**
* true,使使java.net.Socket, true
*/
private boolean socketFactoryFallback;
/**
* 使,使
*/
private int socketFactoryPort = 465;
/**
* SMTP
*/
private long timeout;
/**
* Socket
*/
private long connectionTimeout;
/**
* Socket
*/
private long writeTimeout;
/**
*
*/
private final Map<String, Object> customProperty = new HashMap<>();
// -------------------------------------------------------------- Constructor start
/**
* ,
*/
public MailAccount() {
}
/**
*
*
* @param settingPath
*/
public MailAccount(String settingPath) {
this(new Setting(settingPath));
}
/**
*
*
* @param setting
*/
public MailAccount(Setting setting) {
setting.toBean(this);
}
// -------------------------------------------------------------- Constructor end
/**
* SMTP
*
* @return SMTP
*/
public String getHost() {
return host;
}
/**
* SMTP
*
* @param host SMTP
* @return this
*/
public MailAccount setHost(String host) {
this.host = host;
return this;
}
/**
* SMTP
*
* @return SMTP
*/
public Integer getPort() {
return port;
}
/**
* SMTP
*
* @param port SMTP
* @return this
*/
public MailAccount setPort(Integer port) {
this.port = port;
return this;
}
/**
*
*
* @return
*/
public Boolean isAuth() {
return auth;
}
/**
*
*
* @param isAuth
* @return this
*/
public MailAccount setAuth(boolean isAuth) {
this.auth = isAuth;
return this;
}
/**
*
*
* @return
*/
public String getUser() {
return user;
}
/**
*
*
* @param user
* @return this
*/
public MailAccount setUser(String user) {
this.user = user;
return this;
}
/**
*
*
* @return
*/
public String getPass() {
return pass;
}
/**
*
*
* @param pass
* @return this
*/
public MailAccount setPass(String pass) {
this.pass = pass;
return this;
}
/**
* RFC-822
*
* @return RFC-822
*/
public String getFrom() {
return from;
}
/**
* RFC-822<br>
*
*
* <pre>
* 1. user@xxx.xx
* 2. name &lt;user@xxx.xx&gt;
* </pre>
*
* @param from RFC-822
* @return this
*/
public MailAccount setFrom(String from) {
this.from = from;
return this;
}
/**
*
*
* @return
* @since 4.0.2
*/
public boolean isDebug() {
return debug;
}
/**
*
*
* @param debug
* @return this
* @since 4.0.2
*/
public MailAccount setDebug(boolean debug) {
this.debug = debug;
return this;
}
/**
*
*
* @return {@code null}
*/
public Charset getCharset() {
return charset;
}
/**
* {@code null}
* <pre>
* System.setProperty("mail.mime.charset", charset);
* </pre>
*
* @param charset {@code null} 使mail.mime.charset
* @return this
*/
public MailAccount setCharset(Charset charset) {
this.charset = charset;
return this;
}
/**
* false
*
* @return
*/
public boolean isSplitlongparameters() {
return splitlongparameters;
}
/**
* false<br>
*
* <pre>
* System.setProperty("mail.mime.splitlongparameters", true)
* </pre>
*
* @param splitlongparameters
*/
public void setSplitlongparameters(boolean splitlongparameters) {
this.splitlongparameters = splitlongparameters;
}
/**
* 使{@link #charset} {@code true}
*
* @return 使{@link #charset} {@code true}
* @since 5.7.16
*/
public boolean isEncodefilename() {
return encodefilename;
}
/**
* 使{@link #charset}<br>
* {@code false}
* <ul>
* <li>mail.mime.encodefilename </li>
* <li>mail.mime.charset </li>
* </ul>
*
* @param encodefilename 使{@link #charset}
* @since 5.7.16
*/
public void setEncodefilename(boolean encodefilename) {
this.encodefilename = encodefilename;
}
/**
* 使 STARTTLSSTARTTLSTLSSSL 使
*
* @return 使 STARTTLS
*/
public boolean isStarttlsEnable() {
return this.starttlsEnable;
}
/**
* 使STARTTLSSTARTTLSTLSSSL 使
*
* @param startttlsEnable 使STARTTLS
* @return this
*/
public MailAccount setStarttlsEnable(boolean startttlsEnable) {
this.starttlsEnable = startttlsEnable;
return this;
}
/**
* 使 SSL
*
* @return 使 SSL
*/
public Boolean isSslEnable() {
return this.sslEnable;
}
/**
* 使SSL
*
* @param sslEnable 使SSL
* @return this
*/
public MailAccount setSslEnable(Boolean sslEnable) {
this.sslEnable = sslEnable;
return this;
}
/**
* SSL
*
* @return SSL
* @since 5.5.7
*/
public String getSslProtocols() {
return sslProtocols;
}
/**
* SSL
*
* @param sslProtocols SSL
* @since 5.5.7
*/
public void setSslProtocols(String sslProtocols) {
this.sslProtocols = sslProtocols;
}
/**
* javax.net.SocketFactory,SMTP
*
* @return javax.net.SocketFactory, SMTP
*/
public String getSocketFactoryClass() {
return socketFactoryClass;
}
/**
* javax.net.SocketFactory,SMTP
*
* @param socketFactoryClass javax.net.SocketFactory,SMTP
* @return this
*/
public MailAccount setSocketFactoryClass(String socketFactoryClass) {
this.socketFactoryClass = socketFactoryClass;
return this;
}
/**
* true,使使java.net.Socket, true
*
* @return true, 使使java.net.Socket, true
*/
public boolean isSocketFactoryFallback() {
return socketFactoryFallback;
}
/**
* true,使使java.net.Socket, true
*
* @param socketFactoryFallback true,使使java.net.Socket, true
* @return this
*/
public MailAccount setSocketFactoryFallback(boolean socketFactoryFallback) {
this.socketFactoryFallback = socketFactoryFallback;
return this;
}
/**
* 使,使
*
* @return 使,使
*/
public int getSocketFactoryPort() {
return socketFactoryPort;
}
/**
* 使,使
*
* @param socketFactoryPort 使,使
* @return this
*/
public MailAccount setSocketFactoryPort(int socketFactoryPort) {
this.socketFactoryPort = socketFactoryPort;
return this;
}
/**
* SMTP
*
* @param timeout SMTP
* @return this
* @since 4.1.17
*/
public MailAccount setTimeout(long timeout) {
this.timeout = timeout;
return this;
}
/**
* Socket
*
* @param connectionTimeout Socket
* @return this
* @since 4.1.17
*/
public MailAccount setConnectionTimeout(long connectionTimeout) {
this.connectionTimeout = connectionTimeout;
return this;
}
/**
* Socket
*
* @param writeTimeout Socket
* @return this
* @since 5.8.3
*/
public MailAccount setWriteTimeout(long writeTimeout) {
this.writeTimeout = writeTimeout;
return this;
}
/**
*
*
* @return
* @since 5.6.4
*/
public Map<String, Object> getCustomProperty() {
return customProperty;
}
/**
* mail.smtp.ssl.socketFactory
*
* @param key
* @param value null
* @return this
* @since 5.6.4
*/
public MailAccount setCustomProperty(String key, Object value) {
if (StrUtil.isNotBlank(key) && ObjectUtil.isNotNull(value)) {
this.customProperty.put(key, value);
}
return this;
}
/**
* SMTP
*
* @return {@link Properties}
*/
public Properties getSmtpProps() {
//全局系统参数
System.setProperty(SPLIT_LONG_PARAMS, String.valueOf(this.splitlongparameters));
final Properties p = new Properties();
p.put(MAIL_PROTOCOL, "smtp");
p.put(SMTP_HOST, this.host);
p.put(SMTP_PORT, String.valueOf(this.port));
p.put(SMTP_AUTH, String.valueOf(this.auth));
if (this.timeout > 0) {
p.put(SMTP_TIMEOUT, String.valueOf(this.timeout));
}
if (this.connectionTimeout > 0) {
p.put(SMTP_CONNECTION_TIMEOUT, String.valueOf(this.connectionTimeout));
}
// issue#2355
if (this.writeTimeout > 0) {
p.put(SMTP_WRITE_TIMEOUT, String.valueOf(this.writeTimeout));
}
p.put(MAIL_DEBUG, String.valueOf(this.debug));
if (this.starttlsEnable) {
//STARTTLS是对纯文本通信协议的扩展。它将纯文本连接升级为加密连接TLS或SSL 而不是使用一个单独的加密通信端口。
p.put(STARTTLS_ENABLE, "true");
if (null == this.sslEnable) {
//为了兼容旧版本当用户没有此项配置时按照starttlsEnable开启状态时对待
this.sslEnable = true;
}
}
// SSL
if (null != this.sslEnable && this.sslEnable) {
p.put(SSL_ENABLE, "true");
p.put(SOCKET_FACTORY, socketFactoryClass);
p.put(SOCKET_FACTORY_FALLBACK, String.valueOf(this.socketFactoryFallback));
p.put(SOCKET_FACTORY_PORT, String.valueOf(this.socketFactoryPort));
// issue#IZN95@Gitee在Linux下需自定义SSL协议版本
if (StrUtil.isNotBlank(this.sslProtocols)) {
p.put(SSL_PROTOCOLS, this.sslProtocols);
}
}
// 补充自定义属性,允许自定属性覆盖已经设置的值
p.putAll(this.customProperty);
return p;
}
/**
* null使
*
* @return this
*/
public MailAccount defaultIfEmpty() {
// 去掉发件人的姓名部分
final String fromAddress = InternalMailUtil.parseFirstAddress(this.from, this.charset).getAddress();
if (StrUtil.isBlank(this.host)) {
// 如果SMTP地址为空默认使用smtp.<发件人邮箱后缀>
this.host = StrUtil.format("smtp.{}", StrUtil.subSuf(fromAddress, fromAddress.indexOf('@') + 1));
}
if (StrUtil.isBlank(user)) {
// 如果用户名为空默认为发件人issue#I4FYVY@Gitee
//this.user = StrUtil.subPre(fromAddress, fromAddress.indexOf('@'));
this.user = fromAddress;
}
if (null == this.auth) {
// 如果密码非空白,则使用认证模式
this.auth = (false == StrUtil.isBlank(this.pass));
}
if (null == this.port) {
// 端口在SSL状态下默认与socketFactoryPort一致非SSL状态下默认为25
this.port = (null != this.sslEnable && this.sslEnable) ? this.socketFactoryPort : 25;
}
if (null == this.charset) {
// 默认UTF-8编码
this.charset = CharsetUtil.CHARSET_UTF_8;
}
return this;
}
@Override
public String toString() {
return "MailAccount [host=" + host + ", port=" + port + ", auth=" + auth + ", user=" + user + ", pass=" + (StrUtil.isEmpty(this.pass) ? "" : "******") + ", from=" + from + ", startttlsEnable="
+ starttlsEnable + ", socketFactoryClass=" + socketFactoryClass + ", socketFactoryFallback=" + socketFactoryFallback + ", socketFactoryPort=" + socketFactoryPort + "]";
}
}

@ -0,0 +1,40 @@
package org.dromara.common.mail.utils;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import java.io.Serial;
/**
*
*
* @author xiaoleilu
*/
public class MailException extends RuntimeException {
@Serial
private static final long serialVersionUID = 8247610319171014183L;
public MailException(Throwable e) {
super(ExceptionUtil.getMessage(e), e);
}
public MailException(String message) {
super(message);
}
public MailException(String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params));
}
public MailException(String message, Throwable throwable) {
super(message, throwable);
}
public MailException(String message, Throwable throwable, boolean enableSuppression, boolean writableStackTrace) {
super(message, throwable, enableSuppression, writableStackTrace);
}
public MailException(Throwable throwable, String messageTemplate, Object... params) {
super(StrUtil.format(messageTemplate, params), throwable);
}
}

@ -5,16 +5,13 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.CharUtil; import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.mail.Mail; import jakarta.mail.Authenticator;
import cn.hutool.extra.mail.MailAccount; import jakarta.mail.Session;
import cn.hutool.extra.mail.UserPassAuthenticator;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import javax.mail.Authenticator;
import javax.mail.Session;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection; import java.util.Collection;

@ -0,0 +1,33 @@
package org.dromara.common.mail.utils;
import jakarta.mail.Authenticator;
import jakarta.mail.PasswordAuthentication;
/**
*
*
* @author looly
* @since 3.1.2
*/
public class UserPassAuthenticator extends Authenticator {
private final String user;
private final String pass;
/**
*
*
* @param user
* @param pass
*/
public UserPassAuthenticator(String user, String pass) {
this.user = user;
this.pass = pass;
}
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(this.user, this.pass);
}
}

@ -7,7 +7,7 @@ import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
/** /**
* Mybatis * Mybatis

@ -24,7 +24,7 @@
<!-- Sa-Token 权限认证, 在线文档http://sa-token.dev33.cn/ --> <!-- Sa-Token 权限认证, 在线文档http://sa-token.dev33.cn/ -->
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot3-starter</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

@ -16,7 +16,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
/** /**
* *

@ -49,7 +49,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import javax.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import java.util.List; import java.util.List;
import static com.alibaba.cloud.sentinel.SentinelConstants.BLOCK_PAGE_URL_CONF_KEY; import static com.alibaba.cloud.sentinel.SentinelConstants.BLOCK_PAGE_URL_CONF_KEY;

@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import javax.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

@ -2,8 +2,8 @@ package org.dromara.common.web.core;
import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.LocaleResolver;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.Locale; import java.util.Locale;
/** /**

@ -26,9 +26,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

@ -9,8 +9,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
/** /**

@ -16,9 +16,9 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

@ -6,8 +6,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
/** /**
* test_demo * test_demo

@ -3,8 +3,8 @@ package org.dromara.demo.domain.bo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
/** /**
* test_demo * test_demo

@ -6,8 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
/** /**
* test_tree * test_tree

@ -75,7 +75,7 @@
<!-- Sa-Token 权限认证Reactor响应式集成, 在线文档http://sa-token.dev33.cn/ --> <!-- Sa-Token 权限认证Reactor响应式集成, 在线文档http://sa-token.dev33.cn/ -->
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-reactor-spring-boot-starter</artifactId> <artifactId>sa-token-reactor-spring-boot3-starter</artifactId>
<version>${satoken.version}</version> <version>${satoken.version}</version>
</dependency> </dependency>

@ -19,6 +19,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import java.net.URI; import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -64,9 +65,11 @@ public class WebFluxUtils {
Flux<DataBuffer> body = serverHttpRequest.getBody(); Flux<DataBuffer> body = serverHttpRequest.getBody();
AtomicReference<String> bodyRef = new AtomicReference<>(); AtomicReference<String> bodyRef = new AtomicReference<>();
body.subscribe(buffer -> { body.subscribe(buffer -> {
CharBuffer charBuffer = StandardCharsets.UTF_8.decode(buffer.asByteBuffer()); try (DataBuffer.ByteBufferIterator iterator = buffer.readableByteBuffers()) {
DataBufferUtils.release(buffer); CharBuffer charBuffer = StandardCharsets.UTF_8.decode(iterator.next());
bodyRef.set(charBuffer.toString()); DataBufferUtils.release(buffer);
bodyRef.set(charBuffer.toString());
}
}); });
return bodyRef.get(); return bodyRef.get();
} }
@ -85,8 +88,10 @@ public class WebFluxUtils {
return null; return null;
} }
DataBuffer buffer = (DataBuffer) obj; DataBuffer buffer = (DataBuffer) obj;
CharBuffer charBuffer = StandardCharsets.UTF_8.decode(buffer.asByteBuffer()); try (DataBuffer.ByteBufferIterator iterator = buffer.readableByteBuffers()) {
return charBuffer.toString(); CharBuffer charBuffer = StandardCharsets.UTF_8.decode(iterator.next());
return charBuffer.toString();
}
} }
/** /**

@ -16,7 +16,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

@ -11,8 +11,8 @@ import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.gen.constant.GenConstants; import org.dromara.gen.constant.GenConstants;
import javax.validation.Valid; import jakarta.validation.Valid;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import java.util.List; import java.util.List;
/** /**

@ -10,7 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.JdbcType;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
/** /**
* gen_table_column * gen_table_column

@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import java.time.Duration; import java.time.Duration;
/** /**

@ -17,8 +17,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Arrays; import java.util.Arrays;
/** /**

@ -20,8 +20,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import java.time.Duration; import java.time.Duration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

@ -8,9 +8,9 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.resource.domain.SysOssConfig; import org.dromara.resource.domain.SysOssConfig;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_oss_config * sys_oss_config

@ -6,7 +6,7 @@ import org.dromara.resource.domain.bo.SysOssBo;
import org.dromara.resource.domain.vo.SysOssVo; import org.dromara.resource.domain.vo.SysOssVo;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

@ -30,7 +30,7 @@ import org.springframework.http.MediaType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;

@ -17,7 +17,7 @@ import org.dromara.system.service.ISysLogininforService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -15,7 +15,7 @@ import org.dromara.system.service.ISysOperLogService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -15,7 +15,7 @@ import org.dromara.system.service.ISysConfigService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -17,7 +17,7 @@ import org.dromara.system.service.ISysDictTypeService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

@ -15,7 +15,7 @@ import org.dromara.system.service.ISysDictTypeService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -15,7 +15,7 @@ import org.dromara.system.service.ISysPostService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -22,7 +22,7 @@ import org.dromara.system.service.ISysUserService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**

@ -22,10 +22,10 @@ import org.dromara.system.service.ISysTenantService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

@ -20,9 +20,9 @@ import org.dromara.system.service.ISysTenantPackageService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

@ -30,7 +30,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

@ -8,7 +8,7 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysConfig; import org.dromara.system.domain.SysConfig;
import javax.validation.constraints.*; import jakarta.validation.constraints.*;
/** /**
* sys_config * sys_config

@ -8,7 +8,7 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysDept; import org.dromara.system.domain.SysDept;
import javax.validation.constraints.*; import jakarta.validation.constraints.*;
/** /**
* sys_dept * sys_dept

@ -8,9 +8,9 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysDictData; import org.dromara.system.domain.SysDictData;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_dict_data * sys_dict_data

@ -8,10 +8,10 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysDictType; import org.dromara.system.domain.SysDictType;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import jakarta.validation.constraints.Pattern;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_dict_type * sys_dict_type

@ -9,9 +9,9 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysMenu; import org.dromara.system.domain.SysMenu;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_menu * sys_menu

@ -9,9 +9,9 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.xss.Xss; import org.dromara.common.core.xss.Xss;
import org.dromara.system.domain.SysNotice; import org.dromara.system.domain.SysNotice;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_notice * sys_notice

@ -8,9 +8,9 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysPost; import org.dromara.system.domain.SysPost;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_post * sys_post

@ -10,9 +10,9 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysRole; import org.dromara.system.domain.SysRole;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* sys_role * sys_role

@ -8,8 +8,8 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysTenant; import org.dromara.system.domain.SysTenant;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
/** /**

@ -9,8 +9,8 @@ import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysTenantPackage; import org.dromara.system.domain.SysTenantPackage;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
/** /**
* sys_tenant_package * sys_tenant_package

@ -9,9 +9,9 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.xss.Xss; import org.dromara.common.core.xss.Xss;
import org.dromara.system.domain.SysUser; import org.dromara.system.domain.SysUser;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.util.Date; import java.util.Date;
/** /**

@ -8,8 +8,8 @@ import org.dromara.common.core.xss.Xss;
import org.dromara.common.sensitive.annotation.Sensitive; import org.dromara.common.sensitive.annotation.Sensitive;
import org.dromara.common.sensitive.core.SensitiveStrategy; import org.dromara.common.sensitive.core.SensitiveStrategy;
import javax.validation.constraints.Email; import jakarta.validation.constraints.Email;
import javax.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* *

@ -29,7 +29,7 @@ public class WebSecurityConfigurer {
return httpSecurity return httpSecurity
.headers().frameOptions().disable() .headers().frameOptions().disable()
.and().authorizeRequests() .and().authorizeRequests()
.antMatchers(adminContextPath + "/assets/**" .requestMatchers(adminContextPath + "/assets/**"
, adminContextPath + "/login" , adminContextPath + "/login"
, adminContextPath + "/actuator/**" , adminContextPath + "/actuator/**"
, adminContextPath + "/instances/**" , adminContextPath + "/instances/**"

@ -29,12 +29,21 @@
<properties> <properties>
<nacos.version>2.2.1</nacos.version> <nacos.version>2.2.1</nacos.version>
<!-- 需要与 Nacos 内置 Boot 版本保持一致 --> <!-- 需要与 Nacos 内置 Boot 版本保持一致 -->
<spring-boot.version>2.7.12</spring-boot.version>
<spring-boot-admin.version>2.6.11</spring-boot-admin.version> <spring-boot-admin.version>2.6.11</spring-boot-admin.version>
<nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path> <nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba.nacos</groupId> <groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId> <artifactId>nacos-all</artifactId>
@ -153,16 +162,26 @@
<artifactId>nacos-client</artifactId> <artifactId>nacos-client</artifactId>
</dependency> </dependency>
<!-- SpringBoot Web容器 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>*</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- web 容器使用 undertow 性能更强 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId> <artifactId>spring-boot-starter-jdbc</artifactId>

@ -30,10 +30,19 @@
<seata.version>1.6.1</seata.version> <seata.version>1.6.1</seata.version>
<jcommander.version>1.72</jcommander.version> <jcommander.version>1.72</jcommander.version>
<druid.version>1.2.12</druid.version> <druid.version>1.2.12</druid.version>
<spring-boot.version>2.7.12</spring-boot.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <dependency>
<groupId>io.seata</groupId> <groupId>io.seata</groupId>
<artifactId>seata-bom</artifactId> <artifactId>seata-bom</artifactId>
@ -52,17 +61,26 @@
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<!-- springboot web --> <!-- SpringBoot Web容器 -->
<dependency> <dependency>
<groupId>org.dromara</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>ruoyi-common-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>log4j-to-slf4j</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- web 容器使用 undertow 性能更强 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.seata</groupId> <groupId>io.seata</groupId>
<artifactId>seata-spring-autoconfigure-server</artifactId> <artifactId>seata-spring-autoconfigure-server</artifactId>

@ -15,8 +15,22 @@
<properties> <properties>
<sentinel.version>1.8.6</sentinel.version> <sentinel.version>1.8.6</sentinel.version>
<curator.version>4.0.1</curator.version> <curator.version>4.0.1</curator.version>
<spring-boot.version>2.7.12</spring-boot.version>
</properties> </properties>
<dependencyManagement>
<dependencies>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
@ -52,16 +66,26 @@
<artifactId>sentinel-api-gateway-adapter-common</artifactId> <artifactId>sentinel-api-gateway-adapter-common</artifactId>
</dependency> </dependency>
<!-- SpringBoot Web容器 -->
<dependency> <dependency>
<groupId>org.dromara</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>ruoyi-common-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- web 容器使用 undertow 性能更强 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!-- starter-actuator --> <!-- starter-actuator -->
<dependency> <dependency>

@ -9,6 +9,23 @@
<artifactId>ruoyi-xxl-job-admin</artifactId> <artifactId>ruoyi-xxl-job-admin</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties>
<spring-boot.version>2.7.12</spring-boot.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- SpringBoot 依赖配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->
<dependency> <dependency>
@ -29,10 +46,26 @@
</dependency> </dependency>
<!-- starter-webspring-webmvc + autoconfigure + logback + yaml + tomcat --> <!-- starter-webspring-webmvc + autoconfigure + logback + yaml + tomcat -->
<dependency> <!-- SpringBoot Web容器 -->
<groupId>org.dromara</groupId> <dependency>
<artifactId>ruoyi-common-web</artifactId> <groupId>org.springframework.boot</groupId>
</dependency> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- web 容器使用 undertow 性能更强 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!-- starter-testjunit + spring-test + mockito --> <!-- starter-testjunit + spring-test + mockito -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

Loading…
Cancel
Save