mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
feat(web): 新增 Web 模块,从核心模块拆分 Web 相关自动配置
This commit is contained in:
@@ -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;
|
||||
|
@@ -25,9 +25,10 @@
|
||||
<artifactId>sa-token-jwt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 模块 -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-jwt</artifactId>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -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 自动配置
|
||||
|
@@ -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 异常处理器
|
||||
|
@@ -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 自动配置
|
||||
|
@@ -18,5 +18,11 @@
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-cache-redisson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool 加密解密模块(封装 JDK 中加密解密算法) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -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;
|
||||
|
||||
|
@@ -13,38 +13,6 @@
|
||||
<description>ContiNew Starter 核心模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Hibernate Validator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Web(提供 Spring MVC Web 开发能力,默认内置 Tomcat 服务器) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<!-- 移除内置 Tomcat 服务器 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Undertow 服务器(采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
<!-- 移除 websocket 依赖,后续使用 websocket 可考虑由 Netty 提供。另可解决日志警告:UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.undertow</groupId>
|
||||
<artifactId>undertow-websockets-jsr</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Starter(自动配置相关依赖) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -55,49 +23,40 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger 注解 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- 第三方封装 Ip2region(离线 IP 数据管理框架和定位库,支持亿级别的数据段,10 微秒级别的查询性能,提供了许多主流编程语言的 xdb 数据管理引擎的实现) -->
|
||||
<dependency>
|
||||
<groupId>net.dreamlu</groupId>
|
||||
<artifactId>mica-ip2region</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool(小而全的 Java 工具类库,通过静态方法封装,降低相关 API 的学习成本,提高工作效率,使 Java 拥有函数式语言般的优雅,让 Java 语言也可以“甜甜的”) -->
|
||||
<!-- Hutool 核心模块(核心方法及数据结构包) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-extra</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool JSON 模块(基于 json.org 官方库改造) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-json</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool 扩展模块(提供对第三方库的工具类支持) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-extra</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool HTTP客户端模块(针对 JDK 的 HttpUrlConnection 做一层封装,简化了 HTTPS 请求、文件上传、Cookie 记忆等操作,使 Http 请求变得无比简单) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hutool 数据库模块(在 JDBC 基础上封装的数据库操作工具类,通过包装,使用 ActiveRecord 思想操作数据库) -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-db</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 联系人配置属性
|
||||
*/
|
||||
|
@@ -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";
|
||||
|
||||
/**
|
||||
* 日志配置
|
||||
*/
|
||||
|
@@ -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;
|
@@ -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";
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -92,12 +92,6 @@
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-jwt</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-jwt</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Just Auth(开箱即用的整合第三方登录的开源组件,脱离繁琐的第三方登录 SDK,让登录变得 So easy!) -->
|
||||
@@ -111,10 +105,6 @@
|
||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
@@ -182,12 +172,6 @@
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version>${sms4j.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- AJ-Captcha(行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式) -->
|
||||
@@ -223,12 +207,6 @@
|
||||
<groupId>org.dromara.x-file-storage</groupId>
|
||||
<artifactId>x-file-storage-spring</artifactId>
|
||||
<version>${x-file-storage.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Amazon S3(Amazon Simple Storage Service,亚马逊简单存储服务,通用存储协议 S3,兼容主流云厂商对象存储) -->
|
||||
@@ -243,12 +221,6 @@
|
||||
<groupId>cn.crane4j</groupId>
|
||||
<artifactId>crane4j-spring-boot-starter</artifactId>
|
||||
<version>${crane4j.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Knife4j(前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案) -->
|
||||
@@ -282,7 +254,6 @@
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
@@ -409,6 +380,13 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
|
@@ -42,10 +42,10 @@
|
||||
<artifactId>continew-starter-file-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- API 文档模块 -->
|
||||
<!-- Web 模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-api-doc</artifactId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -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;
|
||||
|
||||
|
@@ -18,5 +18,11 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jakarta(原 Javax Servlet) -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -13,6 +13,12 @@
|
||||
<description>ContiNew Starter JSON 模块 - Jackson</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Boot JSON 模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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.*;
|
||||
|
||||
|
@@ -19,10 +19,10 @@
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<!-- 核心模块 -->
|
||||
<!-- Web 模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-core</artifactId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -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;
|
||||
|
||||
/**
|
||||
* 邮件自动配置
|
||||
|
@@ -18,10 +18,10 @@
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<!-- 核心模块 -->
|
||||
<!-- Web 模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-core</artifactId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
60
continew-starter-web/pom.xml
Normal file
60
continew-starter-web/pom.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
<description>ContiNew Starter Web 模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Boot Web(提供 Spring MVC Web 开发能力,默认内置 Tomcat 服务器) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<!-- 移除内置 Tomcat 服务器 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Undertow 服务器(采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
<!-- 移除 websocket 依赖,后续使用 websocket 可考虑由 Netty 提供。另可解决日志警告:UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.undertow</groupId>
|
||||
<artifactId>undertow-websockets-jsr</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Hibernate Validator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- API 文档模块 -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON 模块 - Jackson -->
|
||||
<dependency>
|
||||
<groupId>top.charles7c.continew</groupId>
|
||||
<artifactId>continew-starter-json-jackson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -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.*;
|
||||
|
@@ -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;
|
@@ -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;
|
@@ -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;
|
||||
|
||||
/**
|
||||
* 全局异常处理器自动配置
|
@@ -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;
|
@@ -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;
|
||||
|
@@ -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;
|
@@ -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;
|
@@ -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;
|
@@ -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;
|
1
pom.xml
1
pom.xml
@@ -70,6 +70,7 @@
|
||||
<module>continew-starter-core</module>
|
||||
<module>continew-starter-json</module>
|
||||
<module>continew-starter-api-doc</module>
|
||||
<module>continew-starter-web</module>
|
||||
<module>continew-starter-log</module>
|
||||
<module>continew-starter-storage</module>
|
||||
<module>continew-starter-file</module>
|
||||
|
Reference in New Issue
Block a user