From 9cf76fe61f2368244a501c1c036c0a55502f5c0a Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 19 Jan 2024 22:40:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=96=B0=E5=A2=9E=20Web=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=EF=BC=8C=E4=BB=8E=E6=A0=B8=E5=BF=83=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8B=86=E5=88=86=20Web=20=E7=9B=B8=E5=85=B3=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SpringDocAutoConfiguration.java | 2 +- .../continew-starter-auth-satoken/pom.xml | 5 +- .../SaTokenAutoConfiguration.java | 2 +- .../GlobalSaTokenExceptionHandler.java | 2 +- .../JetCacheAutoConfiguration.java | 2 +- .../pom.xml | 6 ++ .../SpringCacheAutoConfiguration.java | 2 +- continew-starter-core/pom.xml | 71 ++++--------------- .../project/ProjectProperties.java | 12 ---- .../core/constant/PropertiesConstants.java | 15 ++-- .../GeneralPropertySourceFactory.java | 2 +- .../continew/starter/core/util/IpUtils.java | 40 +---------- ...ot.autoconfigure.AutoConfiguration.imports | 2 +- .../MybatisPlusAutoConfiguration.java | 2 +- continew-starter-dependencies/pom.xml | 36 ++-------- .../continew-starter-extension-crud/pom.xml | 4 +- .../extension/crud/base/BaseController.java | 2 +- .../continew-starter-file-excel/pom.xml | 6 ++ .../continew-starter-json-jackson/pom.xml | 6 ++ .../JacksonAutoConfiguration.java | 2 +- .../starter/log/common/model/LogRequest.java | 2 +- .../RecordableServletHttpResponse.java | 2 +- continew-starter-log/pom.xml | 4 +- .../autoconfigure/MailAutoConfiguration.java | 2 +- continew-starter-storage/pom.xml | 4 +- continew-starter-web/pom.xml | 60 ++++++++++++++++ .../EnableGlobalExceptionHandler.java | 4 +- .../cors/CorsAutoConfiguration.java | 2 +- .../autoconfigure/cors/CorsProperties.java | 2 +- ...obalExceptionHandlerAutoConfiguration.java | 6 +- .../core/exception/GlobalErrorHandler.java | 4 +- .../exception/GlobalExceptionHandler.java | 6 +- .../continew/starter/web}/model/R.java | 2 +- .../starter/web}/util/FileUploadUtils.java | 2 +- .../starter/web}/util/ServletUtils.java | 2 +- .../starter/web}/util/SpringUtils.java | 2 +- pom.xml | 1 + 37 files changed, 151 insertions(+), 177 deletions(-) rename continew-starter-core/src/main/java/top/charles7c/continew/starter/core/{handler => util}/GeneralPropertySourceFactory.java (97%) create mode 100644 continew-starter-web/pom.xml rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/annotation/EnableGlobalExceptionHandler.java (86%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/autoconfigure/cors/CorsAutoConfiguration.java (98%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/autoconfigure/cors/CorsProperties.java (96%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure => continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception}/GlobalExceptionHandlerAutoConfiguration.java (86%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/core/exception/GlobalErrorHandler.java (97%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/core/exception/GlobalExceptionHandler.java (96%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/model/R.java (98%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/util/FileUploadUtils.java (98%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/util/ServletUtils.java (98%) rename {continew-starter-core/src/main/java/top/charles7c/continew/starter/core => continew-starter-web/src/main/java/top/charles7c/continew/starter/web}/util/SpringUtils.java (98%) diff --git a/continew-starter-api-doc/src/main/java/top/charles7c/continew/starter/apidoc/autoconfigure/SpringDocAutoConfiguration.java b/continew-starter-api-doc/src/main/java/top/charles7c/continew/starter/apidoc/autoconfigure/SpringDocAutoConfiguration.java index e6d37d5a..cc01b7d8 100644 --- a/continew-starter-api-doc/src/main/java/top/charles7c/continew/starter/apidoc/autoconfigure/SpringDocAutoConfiguration.java +++ b/continew-starter-api-doc/src/main/java/top/charles7c/continew/starter/apidoc/autoconfigure/SpringDocAutoConfiguration.java @@ -38,7 +38,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; import java.util.List; import java.util.Map; diff --git a/continew-starter-auth/continew-starter-auth-satoken/pom.xml b/continew-starter-auth/continew-starter-auth-satoken/pom.xml index 6cd449a5..c4756f96 100644 --- a/continew-starter-auth/continew-starter-auth-satoken/pom.xml +++ b/continew-starter-auth/continew-starter-auth-satoken/pom.xml @@ -25,9 +25,10 @@ sa-token-jwt + - cn.hutool - hutool-jwt + top.charles7c.continew + continew-starter-web \ No newline at end of file diff --git a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenAutoConfiguration.java b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenAutoConfiguration.java index 20893cd3..79257a36 100644 --- a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenAutoConfiguration.java +++ b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/autoconfigure/SaTokenAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.context.annotation.*; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; /** * Sa-Token 自动配置 diff --git a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/exception/GlobalSaTokenExceptionHandler.java b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/exception/GlobalSaTokenExceptionHandler.java index 53a319e3..0282fd43 100644 --- a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/exception/GlobalSaTokenExceptionHandler.java +++ b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/exception/GlobalSaTokenExceptionHandler.java @@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import top.charles7c.continew.starter.core.model.R; +import top.charles7c.continew.starter.web.model.R; /** * 全局 SaToken 异常处理器 diff --git a/continew-starter-cache/continew-starter-cache-jetcache/src/main/java/top/charles7c/continew/starter/cache/jetcache/autoconfigure/JetCacheAutoConfiguration.java b/continew-starter-cache/continew-starter-cache-jetcache/src/main/java/top/charles7c/continew/starter/cache/jetcache/autoconfigure/JetCacheAutoConfiguration.java index cc8a4cf1..4e8d7698 100644 --- a/continew-starter-cache/continew-starter-cache-jetcache/src/main/java/top/charles7c/continew/starter/cache/jetcache/autoconfigure/JetCacheAutoConfiguration.java +++ b/continew-starter-cache/continew-starter-cache-jetcache/src/main/java/top/charles7c/continew/starter/cache/jetcache/autoconfigure/JetCacheAutoConfiguration.java @@ -22,7 +22,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; /** * JetCache 自动配置 diff --git a/continew-starter-cache/continew-starter-cache-springcache/pom.xml b/continew-starter-cache/continew-starter-cache-springcache/pom.xml index 3c788ecf..959d883d 100644 --- a/continew-starter-cache/continew-starter-cache-springcache/pom.xml +++ b/continew-starter-cache/continew-starter-cache-springcache/pom.xml @@ -18,5 +18,11 @@ top.charles7c.continew continew-starter-cache-redisson + + + + cn.hutool + hutool-crypto + \ No newline at end of file diff --git a/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java b/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java index 1f16507b..fe730892 100644 --- a/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java +++ b/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java @@ -35,7 +35,7 @@ import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.RedisSerializationContext; import org.springframework.data.redis.serializer.StringRedisSerializer; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; import java.util.Map; diff --git a/continew-starter-core/pom.xml b/continew-starter-core/pom.xml index 3f1230eb..73bbd303 100644 --- a/continew-starter-core/pom.xml +++ b/continew-starter-core/pom.xml @@ -13,38 +13,6 @@ ContiNew Starter 核心模块 - - - org.springframework.boot - spring-boot-starter-validation - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - - - org.springframework.boot - spring-boot-starter-undertow - - - - io.undertow - undertow-websockets-jsr - - - - org.springframework.boot @@ -55,49 +23,40 @@ spring-boot-configuration-processor - - - io.swagger.core.v3 - swagger-annotations-jakarta - true - - net.dreamlu mica-ip2region - + cn.hutool hutool-core - - cn.hutool - hutool-extra - - - - cn.hutool - hutool-http - - + cn.hutool hutool-json + + + cn.hutool + hutool-extra + + + + + cn.hutool + hutool-http + + + cn.hutool hutool-db - - - cn.hutool - hutool-crypto - - \ No newline at end of file diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java index 2a363721..4dcedc03 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/project/ProjectProperties.java @@ -16,7 +16,6 @@ package top.charles7c.continew.starter.core.autoconfigure.project; -import cn.hutool.extra.spring.SpringUtil; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -75,17 +74,6 @@ public class ProjectProperties { */ private boolean production = false; - /** - * 是否启用本地解析 IP 归属地 - */ - public static final boolean IP_ADDR_LOCAL_PARSE_ENABLED; - - static { - IP_ADDR_LOCAL_PARSE_ENABLED = SpringUtil - .getProperty("project.ip-addr-local-parse-enabled", boolean.class, false) || SpringUtil - .getProperty("project.ipAddrLocalParseEnabled", boolean.class, false); - } - /** * 联系人配置属性 */ diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/PropertiesConstants.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/PropertiesConstants.java index dfbd974f..2ac92e6b 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/PropertiesConstants.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/constant/PropertiesConstants.java @@ -38,16 +38,21 @@ public class PropertiesConstants { */ public static final String ENABLED = "enabled"; - /** - * 跨域配置 - */ - public static final String CORS = CONTINEW_STARTER + ".cors"; - /** * 线程池配置 */ public static final String THREAD_POOL = CONTINEW_STARTER + ".thread-pool"; + /** + * Web 配置 + */ + public static final String WEB = CONTINEW_STARTER + ".web"; + + /** + * 跨域配置 + */ + public static final String CORS = WEB + ".cors"; + /** * 日志配置 */ diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java similarity index 97% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java rename to continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java index 506d110d..52d1be79 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/handler/GeneralPropertySourceFactory.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.handler; +package top.charles7c.continew.starter.core.util; import cn.hutool.core.util.StrUtil; import org.springframework.boot.env.YamlPropertySourceLoader; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java index b1a08b80..bac6f3c0 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java @@ -21,15 +21,11 @@ import cn.hutool.core.net.NetUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import cn.hutool.http.HtmlUtil; -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.dreamlu.mica.ip2region.core.Ip2regionSearcher; import net.dreamlu.mica.ip2region.core.IpInfo; -import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; import top.charles7c.continew.starter.core.constant.StringConstants; import java.util.Set; @@ -44,47 +40,13 @@ import java.util.Set; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class IpUtils { - /** - * 太平洋网开放 API:查询 IP 归属地 - */ - private static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"; - - /** - * 查询 IP 归属地 - * - * @param ip IP 地址 - * @return IP 归属地 - */ - public static String getAddress(String ip) { - if (ProjectProperties.IP_ADDR_LOCAL_PARSE_ENABLED) { - return getAddressByLocal(ip); - } else { - return getAddressByHttp(ip); - } - } - - /** - * 查询 IP 归属地(网络解析) - * - * @param ip IP 地址 - * @return IP 归属地 - */ - public static String getAddressByHttp(String ip) { - if (isInnerIp(ip)) { - return "内网IP"; - } - String api = String.format(IP_URL, ip); - JSONObject object = JSONUtil.parseObj(HttpUtil.get(api)); - return object.get("addr", String.class); - } - /** * 查询 IP 归属地(本地库解析) * * @param ip IP 地址 * @return IP 归属地 */ - public static String getAddressByLocal(String ip) { + public static String getAddress(String ip) { if (isInnerIp(ip)) { return "内网IP"; } diff --git a/continew-starter-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/continew-starter-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 5f54182d..0d575d01 100644 --- a/continew-starter-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/continew-starter-core/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,4 @@ top.charles7c.continew.starter.core.autoconfigure.project.ProjectAutoConfiguration top.charles7c.continew.starter.core.autoconfigure.threadpool.ThreadPoolAutoConfiguration top.charles7c.continew.starter.core.autoconfigure.threadpool.AsyncAutoConfiguration -top.charles7c.continew.starter.core.autoconfigure.cors.CorsAutoConfiguration +top.charles7c.continew.starter.web.autoconfigure.cors.CorsAutoConfiguration diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java index ce92c2c3..1dc2844c 100644 --- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java +++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/autoconfigure/MybatisPlusAutoConfiguration.java @@ -35,7 +35,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.PropertySource; import org.springframework.transaction.annotation.EnableTransactionManagement; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter; import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionHandlerImpl; diff --git a/continew-starter-dependencies/pom.xml b/continew-starter-dependencies/pom.xml index 797f0e42..0036e156 100644 --- a/continew-starter-dependencies/pom.xml +++ b/continew-starter-dependencies/pom.xml @@ -92,12 +92,6 @@ cn.dev33 sa-token-jwt ${sa-token.version} - - - cn.hutool - hutool-jwt - - @@ -111,10 +105,6 @@ justauth-spring-boot-starter 1.4.0 - - cn.hutool - hutool-core - me.zhyd.oauth JustAuth @@ -182,12 +172,6 @@ org.dromara.sms4j sms4j-spring-boot-starter ${sms4j.version} - - - cn.hutool - hutool-crypto - - @@ -223,12 +207,6 @@ org.dromara.x-file-storage x-file-storage-spring ${x-file-storage.version} - - - cn.hutool - hutool-core - - @@ -243,12 +221,6 @@ cn.crane4j crane4j-spring-boot-starter ${crane4j.version} - - - cn.hutool - hutool-core - - @@ -282,7 +254,6 @@ pom import - cn.hutool hutool-all @@ -409,6 +380,13 @@ ${revision} + + + top.charles7c.continew + continew-starter-web + ${revision} + + top.charles7c.continew diff --git a/continew-starter-extension/continew-starter-extension-crud/pom.xml b/continew-starter-extension/continew-starter-extension-crud/pom.xml index 4e7863c3..16f984dd 100644 --- a/continew-starter-extension/continew-starter-extension-crud/pom.xml +++ b/continew-starter-extension/continew-starter-extension-crud/pom.xml @@ -42,10 +42,10 @@ continew-starter-file-excel - + top.charles7c.continew - continew-starter-api-doc + continew-starter-web \ No newline at end of file diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseController.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseController.java index 87031416..129f82e3 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseController.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseController.java @@ -28,12 +28,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.core.model.R; import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; import top.charles7c.continew.starter.extension.crud.enums.Api; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageResp; +import top.charles7c.continew.starter.web.model.R; import java.util.List; diff --git a/continew-starter-file/continew-starter-file-excel/pom.xml b/continew-starter-file/continew-starter-file-excel/pom.xml index 944ef30e..0b29f565 100644 --- a/continew-starter-file/continew-starter-file-excel/pom.xml +++ b/continew-starter-file/continew-starter-file-excel/pom.xml @@ -18,5 +18,11 @@ com.alibaba easyexcel + + + + jakarta.servlet + jakarta.servlet-api + \ No newline at end of file diff --git a/continew-starter-json/continew-starter-json-jackson/pom.xml b/continew-starter-json/continew-starter-json-jackson/pom.xml index 3d3aaed4..e673266f 100644 --- a/continew-starter-json/continew-starter-json-jackson/pom.xml +++ b/continew-starter-json/continew-starter-json-jackson/pom.xml @@ -13,6 +13,12 @@ ContiNew Starter JSON 模块 - Jackson + + + org.springframework.boot + spring-boot-starter-json + + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/continew-starter-json/continew-starter-json-jackson/src/main/java/top/charles7c/continew/starter/json/jackson/autoconfigure/JacksonAutoConfiguration.java b/continew-starter-json/continew-starter-json-jackson/src/main/java/top/charles7c/continew/starter/json/jackson/autoconfigure/JacksonAutoConfiguration.java index 62b81fcb..0fb850a0 100644 --- a/continew-starter-json/continew-starter-json-jackson/src/main/java/top/charles7c/continew/starter/json/jackson/autoconfigure/JacksonAutoConfiguration.java +++ b/continew-starter-json/continew-starter-json-jackson/src/main/java/top/charles7c/continew/starter/json/jackson/autoconfigure/JacksonAutoConfiguration.java @@ -29,7 +29,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.PropertySource; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; import top.charles7c.continew.starter.json.jackson.serializer.BigNumberSerializer; import java.math.BigInteger; diff --git a/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java b/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java index 1eb956ce..e587eff0 100644 --- a/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java +++ b/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java @@ -21,8 +21,8 @@ import lombok.Data; import org.springframework.http.HttpHeaders; import top.charles7c.continew.starter.core.util.ExceptionUtils; import top.charles7c.continew.starter.core.util.IpUtils; -import top.charles7c.continew.starter.core.util.ServletUtils; import top.charles7c.continew.starter.log.common.enums.Include; +import top.charles7c.continew.starter.web.util.ServletUtils; import java.net.URI; import java.util.Map; diff --git a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java index 1a427c07..1c67b4c9 100644 --- a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java +++ b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java @@ -22,8 +22,8 @@ import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.util.ContentCachingResponseWrapper; import org.springframework.web.util.WebUtils; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.core.util.ServletUtils; import top.charles7c.continew.starter.log.common.model.RecordableHttpResponse; +import top.charles7c.continew.starter.web.util.ServletUtils; import java.util.*; diff --git a/continew-starter-log/pom.xml b/continew-starter-log/pom.xml index d0407590..441dc5bf 100644 --- a/continew-starter-log/pom.xml +++ b/continew-starter-log/pom.xml @@ -19,10 +19,10 @@ - + top.charles7c.continew - continew-starter-core + continew-starter-web \ No newline at end of file diff --git a/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/autoconfigure/MailAutoConfiguration.java b/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/autoconfigure/MailAutoConfiguration.java index 4172beca..acfa1b88 100644 --- a/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/autoconfigure/MailAutoConfiguration.java +++ b/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/autoconfigure/MailAutoConfiguration.java @@ -20,7 +20,7 @@ import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.PropertySource; -import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory; +import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory; /** * 邮件自动配置 diff --git a/continew-starter-storage/pom.xml b/continew-starter-storage/pom.xml index 5ee7fd53..ec92a893 100644 --- a/continew-starter-storage/pom.xml +++ b/continew-starter-storage/pom.xml @@ -18,10 +18,10 @@ - + top.charles7c.continew - continew-starter-core + continew-starter-web \ No newline at end of file diff --git a/continew-starter-web/pom.xml b/continew-starter-web/pom.xml new file mode 100644 index 00000000..db05817d --- /dev/null +++ b/continew-starter-web/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + top.charles7c.continew + continew-starter + ${revision} + + + continew-starter-web + ContiNew Starter Web 模块 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + + org.springframework.boot + spring-boot-starter-undertow + + + + io.undertow + undertow-websockets-jsr + + + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + top.charles7c.continew + continew-starter-api-doc + + + + + top.charles7c.continew + continew-starter-json-jackson + + + \ No newline at end of file diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/annotation/EnableGlobalExceptionHandler.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/annotation/EnableGlobalExceptionHandler.java similarity index 86% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/annotation/EnableGlobalExceptionHandler.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/annotation/EnableGlobalExceptionHandler.java index 09d981ff..bbdffea8 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/annotation/EnableGlobalExceptionHandler.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/annotation/EnableGlobalExceptionHandler.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.annotation; +package top.charles7c.continew.starter.web.annotation; import org.springframework.context.annotation.Import; -import top.charles7c.continew.starter.core.autoconfigure.GlobalExceptionHandlerAutoConfiguration; +import top.charles7c.continew.starter.web.autoconfigure.exception.GlobalExceptionHandlerAutoConfiguration; import java.lang.annotation.*; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsAutoConfiguration.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsAutoConfiguration.java similarity index 98% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsAutoConfiguration.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsAutoConfiguration.java index 1c0117cd..3b63fcde 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsAutoConfiguration.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.autoconfigure.cors; +package top.charles7c.continew.starter.web.autoconfigure.cors; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.AutoConfiguration; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsProperties.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsProperties.java similarity index 96% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsProperties.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsProperties.java index 9350abd7..9f357858 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/cors/CorsProperties.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/cors/CorsProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.autoconfigure.cors; +package top.charles7c.continew.starter.web.autoconfigure.cors; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/GlobalExceptionHandlerAutoConfiguration.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandlerAutoConfiguration.java similarity index 86% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/GlobalExceptionHandlerAutoConfiguration.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandlerAutoConfiguration.java index f0b54f2f..a47b852d 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/autoconfigure/GlobalExceptionHandlerAutoConfiguration.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandlerAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.autoconfigure; +package top.charles7c.continew.starter.web.autoconfigure.exception; import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; @@ -22,8 +22,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import top.charles7c.continew.starter.core.exception.GlobalErrorHandler; -import top.charles7c.continew.starter.core.exception.GlobalExceptionHandler; +import top.charles7c.continew.starter.web.core.exception.GlobalErrorHandler; +import top.charles7c.continew.starter.web.core.exception.GlobalExceptionHandler; /** * 全局异常处理器自动配置 diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalErrorHandler.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalErrorHandler.java similarity index 97% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalErrorHandler.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalErrorHandler.java index 1a9824b7..32180f9c 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalErrorHandler.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalErrorHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.exception; +package top.charles7c.continew.starter.web.core.exception; import cn.hutool.core.bean.BeanUtil; import cn.hutool.json.JSONUtil; @@ -32,7 +32,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -import top.charles7c.continew.starter.core.model.R; +import top.charles7c.continew.starter.web.model.R; import java.io.IOException; import java.util.List; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalExceptionHandler.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalExceptionHandler.java similarity index 96% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalExceptionHandler.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalExceptionHandler.java index 8ba15470..c68de3ba 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/exception/GlobalExceptionHandler.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/core/exception/GlobalExceptionHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.exception; +package top.charles7c.continew.starter.web.core.exception; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; @@ -33,8 +33,10 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.multipart.MaxUploadSizeExceededException; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.core.model.R; +import top.charles7c.continew.starter.core.exception.BadRequestException; +import top.charles7c.continew.starter.core.exception.BusinessException; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.web.model.R; import java.util.Objects; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/model/R.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/model/R.java similarity index 98% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/model/R.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/model/R.java index 4aac70b2..b07a82be 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/model/R.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/model/R.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.model; +package top.charles7c.continew.starter.web.model; import cn.hutool.core.date.DateUtil; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/FileUploadUtils.java similarity index 98% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/FileUploadUtils.java index f73e320b..0ff7f988 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/FileUploadUtils.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/FileUploadUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.util; +package top.charles7c.continew.starter.web.util; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/ServletUtils.java similarity index 98% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/ServletUtils.java index 80a7ed10..733081b0 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/ServletUtils.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/ServletUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.util; +package top.charles7c.continew.starter.web.util; import cn.hutool.core.map.MapUtil; import cn.hutool.http.useragent.UserAgent; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringUtils.java similarity index 98% rename from continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java rename to continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringUtils.java index 379d4c88..bf71980b 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/SpringUtils.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.starter.core.util; +package top.charles7c.continew.starter.web.util; import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.StrUtil; diff --git a/pom.xml b/pom.xml index 06c3e100..84efa48d 100644 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,7 @@ continew-starter-core continew-starter-json continew-starter-api-doc + continew-starter-web continew-starter-log continew-starter-storage continew-starter-file