diff --git a/README.md b/README.md index 77f9edb..51f5076 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

- Downloads - Build Status + Downloads + Build Status Build Status - Coverage Status - Downloads + Coverage Status + Downloads
Downloads @@ -22,7 +22,7 @@ * 极简封装了多租户底层,用更少的代码换来拓展性更强的SaaS多租户系统。 * 借鉴OAuth2,自研多终端认证系统,可控制子系统的token权限互相隔离。 * 借鉴Security,自研Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。 -* 稳定生产了六年,经历了从 Camden -> Hoxton -> 2025 的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构。 +* 稳定生产了九年,经历了从 Camden -> Hoxton -> 2025 的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构。 * 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。 ## 架构图 @@ -32,14 +32,14 @@ | 技术栈 | 版本 | |----------------------|------------| -| Java | 17+ | +| Java | 21+ | | NodeJS | 18+ | -| Spring | 6.2.17 | -| Spring Boot | 3.5.13 | -| Spring Cloud | 2025.0.2 | -| Spring Cloud Alibaba | 2025.0.0.0 | -| Nacos Alibaba | 3.1.2 | -| Mybatis Plus | 3.5.14 | +| Spring | 7.0.8 | +| Spring Boot | 4.1.0 | +| Spring Cloud | 2025.1.2 | +| Spring Cloud Alibaba | 2025.1.0.0 | +| Nacos Alibaba | 3.2.2 | +| Mybatis Plus | 3.5.17 | ## 工程结构 @@ -122,7 +122,6 @@ blade-tool |---------------------------|--------------------------------------------------------------------------------------------------------------------------| | SpringBlade开发手册一览 | [https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) | | SpringBlade常见问题集锦 | [https://sns.bladex.cn/article-14966.html](https://sns.bladex.cn/article-14966.html) | -| SpringBlade基于Kuboard部署K8S | [https://kuboard.cn/learning/k8s-practice/spring-blade/](https://kuboard.cn/learning/k8s-practice/spring-blade/) | | SpringBlade基于Rainbond部署 | [https://www.rainbond.com/docs/micro-service/example/blade](https://www.rainbond.com/docs/micro-service/example/blade) | diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index c9644eb..c991aa8 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -78,7 +78,7 @@ com.baomidou - mybatis-plus-spring-boot3-starter + mybatis-plus-spring-boot4-starter org.mybatis @@ -92,7 +92,7 @@ com.alibaba - druid-spring-boot-3-starter + druid-spring-boot-4-starter diff --git a/blade-core-boot/src/main/resources/bootstrap.yml b/blade-core-boot/src/main/resources/bootstrap.yml index 6fbbf8c..3c0ebe1 100644 --- a/blade-core-boot/src/main/resources/bootstrap.yml +++ b/blade-core-boot/src/main/resources/bootstrap.yml @@ -1,21 +1,12 @@ #服务器配置 server: - undertow: - # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理 - buffer-size: 1024 - # 是否分配的直接内存 - direct-buffers: true + tomcat: # 线程配置 threads: - # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程 - io: 16 - # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载 - worker: 400 - servlet: - # 编码配置 - encoding: - charset: UTF-8 - force: true + # 最大工作线程数(可同时处理请求的线程上限) + max: 400 + # 最小空闲工作线程数(保持存活的常驻线程数) + min-spare: 16 #spring配置 spring: @@ -26,11 +17,13 @@ spring: multipart: max-file-size: 256MB max-request-size: 1024MB + # 编码配置 + encoding: + charset: UTF-8 + force: true web: resources: add-mappings: false - mvc: - throw-exception-if-no-handler-found: true datasource: driver-class-name: com.mysql.cj.jdbc.Driver druid: @@ -101,7 +94,7 @@ mybatis-plus: swagger: title: SpringBlade 接口文档系统 description: SpringBlade 接口文档系统 - version: 3.7.2 + version: 5.0.0 license: Powered By SpringBlade licenseUrl: https://bladex.vip terms-of-service-url: https://bladex.vip diff --git a/blade-core-boot/src/main/resources/log/logback_dev.xml b/blade-core-boot/src/main/resources/log/logback_dev.xml index a1b35e0..ccd506b 100644 --- a/blade-core-boot/src/main/resources/log/logback_dev.xml +++ b/blade-core-boot/src/main/resources/log/logback_dev.xml @@ -57,8 +57,8 @@ - - + + diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index efc4e41..a839b97 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -23,15 +23,16 @@ org.springblade blade-core-secure + + + org.springframework.boot + spring-boot-restclient + org.springframework.cloud spring-cloud-starter-openfeign - - io.github.openfeign - feign-okhttp - org.springframework.cloud spring-cloud-starter-loadbalancer @@ -71,6 +72,12 @@ com.alibaba.nacos nacos-client + + + com.alibaba.nacos + logback-adapter + + diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignFallback.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignFallback.java index 3b38986..18fe7ea 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignFallback.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/BladeFeignFallback.java @@ -25,7 +25,7 @@ import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.cglib.proxy.MethodInterceptor; import org.springframework.cglib.proxy.MethodProxy; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.lang.reflect.Method; import java.util.Objects; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeFeignAccountGetter.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeFeignAccountGetter.java index d0f18f1..4d4059a 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeFeignAccountGetter.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeFeignAccountGetter.java @@ -16,7 +16,7 @@ package org.springblade.core.cloud.header; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import jakarta.servlet.http.HttpServletRequest; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersCallable.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersCallable.java index 9a08c38..21e1527 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersCallable.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersCallable.java @@ -17,7 +17,7 @@ package org.springblade.core.cloud.header; import org.springblade.core.cloud.props.BladeFeignHeadersProperties; import org.springframework.http.HttpHeaders; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.concurrent.Callable; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersContextHolder.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersContextHolder.java index d36917e..beacef3 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersContextHolder.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/header/BladeHttpHeadersContextHolder.java @@ -20,7 +20,7 @@ import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.WebUtil; import org.springframework.core.NamedThreadLocal; import org.springframework.http.HttpHeaders; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.PatternMatchUtils; import jakarta.servlet.http.HttpServletRequest; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateConfiguration.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateConfiguration.java index ca05682..097da13 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateConfiguration.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateConfiguration.java @@ -33,14 +33,14 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.boot.restclient.RestTemplateBuilder; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.web.client.RestTemplate; import javax.net.ssl.SSLContext; @@ -154,8 +154,7 @@ public class RestTemplateConfiguration { @Bean @ConditionalOnMissingBean public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder, OkHttpClient okHttpClient) { - restTemplateBuilder.requestFactory(() -> new OkHttp3ClientHttpRequestFactory(okHttpClient)); - RestTemplate restTemplate = restTemplateBuilder.build(); + RestTemplate restTemplate = restTemplateBuilder.requestFactory(() -> new OkHttp3ClientHttpRequestFactory(okHttpClient)).build(); configMessageConverters(context, restTemplate.getMessageConverters()); return restTemplate; } @@ -178,14 +177,14 @@ public class RestTemplateConfiguration { @LoadBalanced @ConditionalOnMissingBean public LbRestTemplate lbRestTemplate(RestTemplateBuilder restTemplateBuilder, OkHttpClient okHttpClient) { - restTemplateBuilder.requestFactory(() -> new OkHttp3ClientHttpRequestFactory(okHttpClient)); - LbRestTemplate restTemplate = restTemplateBuilder.build(LbRestTemplate.class); + LbRestTemplate restTemplate = restTemplateBuilder.requestFactory(() -> new OkHttp3ClientHttpRequestFactory(okHttpClient)).build(LbRestTemplate.class); restTemplate.getInterceptors().add(context.getBean(RestTemplateHeaderInterceptor.class)); configMessageConverters(context, restTemplate.getMessageConverters()); return restTemplate; } } + @SuppressWarnings("removal") private static void configMessageConverters(ApplicationContext context, List> converters) { converters.removeIf(x -> x instanceof StringHttpMessageConverter || x instanceof MappingJackson2HttpMessageConverter); converters.add(new StringHttpMessageConverter(Charsets.UTF_8)); diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateHeaderInterceptor.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateHeaderInterceptor.java index f9d1df2..d88ba6e 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateHeaderInterceptor.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/RestTemplateHeaderInterceptor.java @@ -24,7 +24,7 @@ import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/AbstractStreamingClientHttpRequest.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/AbstractStreamingClientHttpRequest.java index 3b362c6..2947370 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/AbstractStreamingClientHttpRequest.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/AbstractStreamingClientHttpRequest.java @@ -20,7 +20,7 @@ import org.springframework.http.StreamingHttpOutputMessage; import org.springframework.http.client.AbstractClientHttpRequest; import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import org.springframework.util.FastByteArrayOutputStream; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequest.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequest.java index 3b682a2..eb17c77 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequest.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequest.java @@ -25,7 +25,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.StringUtils; import java.io.IOException; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequestFactory.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequestFactory.java index ac162fb..12b5774 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequestFactory.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpRequestFactory.java @@ -18,7 +18,7 @@ package org.springblade.core.cloud.http.client; import okhttp3.Cache; import okhttp3.OkHttpClient; -import org.jetbrains.annotations.NotNull; +import org.jspecify.annotations.NonNull; import org.springframework.beans.factory.DisposableBean; import org.springframework.http.HttpMethod; import org.springframework.http.client.ClientHttpRequest; @@ -133,7 +133,7 @@ public class OkHttp3ClientHttpRequestFactory implements ClientHttpRequestFactory } - @NotNull + @NonNull @Override public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) { return new OkHttp3ClientHttpRequest(this.client, uri, httpMethod); diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpResponse.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpResponse.java index 297cd35..550f28e 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpResponse.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/http/client/OkHttp3ClientHttpResponse.java @@ -20,7 +20,7 @@ import okhttp3.ResponseBody; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatusCode; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import java.io.IOException; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/props/BladeFeignHeadersProperties.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/props/BladeFeignHeadersProperties.java index 2978ce3..2ef7c6c 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/props/BladeFeignHeadersProperties.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/props/BladeFeignHeadersProperties.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.Arrays; import java.util.List; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeRequestMappingHandlerMapping.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeRequestMappingHandlerMapping.java index 4bc6851..b7246a9 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeRequestMappingHandlerMapping.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeRequestMappingHandlerMapping.java @@ -20,7 +20,7 @@ import org.springblade.core.cloud.annotation.UrlVersion; import org.springblade.core.tool.utils.StringPool; import org.springblade.core.tool.utils.StringUtil; import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeWebMvcRegistrations.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeWebMvcRegistrations.java index 872fc69..8de4f98 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeWebMvcRegistrations.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/BladeWebMvcRegistrations.java @@ -15,7 +15,7 @@ */ package org.springblade.core.cloud.version; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; +import org.springframework.boot.webmvc.autoconfigure.WebMvcRegistrations; import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; diff --git a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/VersionMappingAutoConfiguration.java b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/VersionMappingAutoConfiguration.java index 49444ab..c95fbd4 100644 --- a/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/VersionMappingAutoConfiguration.java +++ b/blade-core-cloud/src/main/java/org/springblade/core/cloud/version/VersionMappingAutoConfiguration.java @@ -17,7 +17,7 @@ package org.springblade.core.cloud.version; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; +import org.springframework.boot.webmvc.autoconfigure.WebMvcRegistrations; import org.springframework.context.annotation.Bean; /** diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index d961e9b..fcd55f9 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -22,35 +22,13 @@ org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - org.springframework.boot - spring-boot-starter-undertow + spring-boot-starter-webmvc jakarta.servlet jakarta.servlet-api - - javax.xml.bind - jaxb-api - - - com.sun.xml.bind - jaxb-core - - - com.sun.xml.bind - jaxb-impl - jakarta.activation jakarta.activation-api diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java b/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java index ebd77d0..7f20587 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/BladeApplication.java @@ -98,13 +98,14 @@ public class BladeApplication { props.setProperty("blade.env", profile); props.setProperty("blade.name", appName); props.setProperty("blade.is-local", String.valueOf(isLocalDev())); - props.setProperty("blade.dev-mode", profile.equals(AppConstant.PROD_CODE) ? "false" : "true"); + props.setProperty("blade.dev-mode", Boolean.toString(!profile.equals(AppConstant.PROD_CODE))); props.setProperty("blade.service.version", AppConstant.APPLICATION_VERSION); props.setProperty("spring.main.allow-bean-definition-overriding", "true"); props.setProperty("spring.cloud.sentinel.transport.dashboard", SentinelConstant.SENTINEL_ADDR); props.setProperty("spring.cloud.alibaba.seata.tx-service-group", appName.concat(NacosConstant.NACOS_GROUP_SUFFIX)); props.setProperty("spring.config.import", String.join(",", NacosConstant.dataId(), NacosConstant.dataId(profile), NacosConstant.dataId(appName, profile))); props.setProperty("nacos.logging.default.config.enabled", "false"); + props.setProperty("management.info.process.enabled", "true"); // 加载自定义组件 List launcherList = new ArrayList<>(); ServiceLoader.load(LauncherService.class).forEach(launcherList::add); diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/StartEventListener.java b/blade-core-launch/src/main/java/org/springblade/core/launch/StartEventListener.java index eb94402..2163d1d 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/StartEventListener.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/StartEventListener.java @@ -17,7 +17,7 @@ package org.springblade.core.launch; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.AutoConfiguration; -import org.springframework.boot.web.context.WebServerInitializedEvent; +import org.springframework.boot.web.server.context.WebServerInitializedEvent; import org.springframework.context.event.EventListener; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java index 1b31760..300bff8 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java @@ -76,10 +76,6 @@ public interface AppConstant { * 资源模块名称 */ String APPLICATION_RESOURCE_NAME = APPLICATION_NAME_PREFIX + "resource"; - /** - * 链路追踪模块名称 - */ - String APPLICATION_ZIPKIN_NAME = APPLICATION_NAME_PREFIX + "zipkin"; /** * 报表系统名称 */ diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladeProperties.java b/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladeProperties.java index 8a3da2b..c69d8ed 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladeProperties.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/props/BladeProperties.java @@ -22,7 +22,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.EnvironmentAware; import org.springframework.core.env.Environment; import org.springframework.core.env.EnvironmentCapable; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/blade-core-launch/src/main/java/org/springblade/core/launch/server/ServerInfo.java b/blade-core-launch/src/main/java/org/springblade/core/launch/server/ServerInfo.java index 378a83e..a0eb132 100644 --- a/blade-core-launch/src/main/java/org/springblade/core/launch/server/ServerInfo.java +++ b/blade-core-launch/src/main/java/org/springblade/core/launch/server/ServerInfo.java @@ -20,7 +20,7 @@ import org.springblade.core.launch.utils.INetUtil; import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfiguration; -import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.web.server.autoconfigure.ServerProperties; /** * 服务器信息 diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/aspect/AuthAspect.java b/blade-core-secure/src/main/java/org/springblade/core/secure/aspect/AuthAspect.java index 9dbb30a..970baac 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/aspect/AuthAspect.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/aspect/AuthAspect.java @@ -37,7 +37,7 @@ import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; -import org.springframework.lang.NonNull; +import org.jspecify.annotations.NonNull; import java.lang.reflect.Method; diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java b/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java index b6718dd..631c1cd 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/registry/SecureRegistry.java @@ -39,6 +39,7 @@ public class SecureRegistry { this.defaultExcludePatterns.add("/actuator/health/**"); this.defaultExcludePatterns.add("/v3/api-docs/**"); this.defaultExcludePatterns.add("/swagger-ui/**"); + this.defaultExcludePatterns.add("/swagger-ui.html"); this.defaultExcludePatterns.add("/auth/**"); this.defaultExcludePatterns.add("/oauth/**"); this.defaultExcludePatterns.add("/token/**"); diff --git a/blade-core-test/src/main/java/org/springblade/core/test/BladeSpringExtension.java b/blade-core-test/src/main/java/org/springblade/core/test/BladeSpringExtension.java index 1b7b573..64eb1fa 100644 --- a/blade-core-test/src/main/java/org/springblade/core/test/BladeSpringExtension.java +++ b/blade-core-test/src/main/java/org/springblade/core/test/BladeSpringExtension.java @@ -25,7 +25,7 @@ import org.springblade.core.launch.constant.SentinelConstant; import org.springblade.core.launch.service.LauncherService; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.lang.NonNull; +import org.jspecify.annotations.NonNull; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.*; diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 02c43cb..adafbee 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -24,6 +24,15 @@ org.springblade blade-core-launch + + + org.springframework.boot + spring-boot-jackson2 + + + com.fasterxml.jackson.core + jackson-databind + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java b/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java index 8141e02..3350b69 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java @@ -23,7 +23,7 @@ import lombok.Setter; import lombok.ToString; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.ObjectUtil; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serial; import java.io.Serializable; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java index d5aef00..7985a2d 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java @@ -15,37 +15,60 @@ */ package org.springblade.core.tool.config; +import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import org.springblade.core.tool.jackson.BladeJacksonProperties; -import org.springblade.core.tool.jackson.JsonUtil; +import org.springblade.core.tool.jackson.BladeJavaTimeModule; +import org.springblade.core.tool.jackson.BladeViewAnnotationIntrospector; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.jackson2.autoconfigure.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.context.annotation.Bean; +import java.text.SimpleDateFormat; +import java.time.ZoneId; +import java.util.Locale; +import java.util.TimeZone; + /** * Jackson配置类 * * @author Chill */ -@AutoConfiguration(before = JacksonAutoConfiguration.class) +@AutoConfiguration @ConditionalOnClass(ObjectMapper.class) @EnableConfigurationProperties(BladeJacksonProperties.class) +@SuppressWarnings({"deprecation", "removal"}) public class JacksonConfiguration { @Bean - @ConditionalOnMissingBean - public ObjectMapper objectMapper() { - //创建默认的ObjectMapper - ObjectMapper objectMapper = JsonUtil.getInstance(); - //允许空字符串序列化为null对象 - objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - //自定义拓展配置 - objectMapper.findAndRegisterModules(); - return objectMapper; + public Jackson2ObjectMapperBuilderCustomizer bladeJacksonCustomizer() { + return builder -> { + // 默认视图包含 / 兼容宽松的读取特性 / 允许空字符串反序列化为 null 对象 + builder.featuresToEnable( + MapperFeature.DEFAULT_VIEW_INCLUSION, + JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, + JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, + JsonParser.Feature.ALLOW_SINGLE_QUOTES, + DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + // 日期不序列化为时间戳 / 空对象不报错 / 未知属性不报错 + builder.featuresToDisable( + SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, + SerializationFeature.FAIL_ON_EMPTY_BEANS, + DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + builder.locale(Locale.CHINA); + builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault())); + builder.dateFormat(new SimpleDateFormat(DateUtil.PATTERN_DATETIME, Locale.CHINA)); + builder.modulesToInstall(new BladeJavaTimeModule()); + builder.findModulesViaServiceLoader(true); + // 视图注解内省器,让 Jackson 识别 @BladeView + builder.annotationIntrospector(introspector -> new BladeViewAnnotationIntrospector()); + }; } } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonLauncherServiceImpl.java b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonLauncherServiceImpl.java new file mode 100644 index 0000000..167be61 --- /dev/null +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonLauncherServiceImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springblade.core.tool.config; + +import net.dreamlu.mica.auto.annotation.AutoService; +import org.springblade.core.launch.service.LauncherService; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.core.Ordered; + +import java.util.Properties; + +/** + * Jackson 启动服务 + * + * @author Chill + */ +@AutoService(LauncherService.class) +public class JacksonLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile) { + Properties props = System.getProperties(); + // Spring Boot 4 默认 JSON 底座为 Jackson 3,命令式 HTTP 消息转换器与反应式编解码器需分别指定首选实现, + // 两处同时锁回 Jackson 2,确保 @BladeView 视图过滤、大数转字符串等既有序列化约定在 servlet 与 webflux 两侧表现一致 + props.setProperty("spring.http.converters.preferred-json-mapper", "jackson2"); + props.setProperty("spring.http.codecs.preferred-json-mapper", "jackson2"); + } + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + +} diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/config/MessageConfiguration.java b/blade-core-tool/src/main/java/org/springblade/core/tool/config/MessageConfiguration.java index d603e43..1a6b3f2 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/config/MessageConfiguration.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/config/MessageConfiguration.java @@ -29,6 +29,7 @@ import org.springframework.http.converter.json.AbstractJackson2HttpMessageConver import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.List; +import java.util.ListIterator; /** * 消息配置类 @@ -47,13 +48,23 @@ public class MessageConfiguration implements WebMvcConfigurer { * 使用 JACKSON 作为JSON MessageConverter */ @Override - public void configureMessageConverters(List> converters) { - converters.removeIf(x -> x instanceof StringHttpMessageConverter || x instanceof AbstractJackson2HttpMessageConverter); - converters.add(new StringHttpMessageConverter(Charsets.UTF_8)); - converters.add(new ByteArrayHttpMessageConverter()); - converters.add(new ResourceHttpMessageConverter()); - converters.add(new ResourceRegionHttpMessageConverter()); - converters.add(new MappingApiJackson2HttpMessageConverter(objectMapper, properties)); + @SuppressWarnings("removal") + public void extendMessageConverters(List> converters) { + MappingApiJackson2HttpMessageConverter bladeJson = new MappingApiJackson2HttpMessageConverter(objectMapper, properties); + boolean jsonReplaced = false; + ListIterator> iterator = converters.listIterator(); + while (iterator.hasNext()) { + HttpMessageConverter converter = iterator.next(); + if (converter instanceof AbstractJackson2HttpMessageConverter) { + iterator.set(bladeJson); + jsonReplaced = true; + } else if (converter instanceof StringHttpMessageConverter) { + iterator.set(new StringHttpMessageConverter(Charsets.UTF_8)); + } + } + if (!jsonReplaced) { + converters.add(0, bladeJson); + } } } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/config/RedisConfiguration.java b/blade-core-tool/src/main/java/org/springblade/core/tool/config/RedisConfiguration.java index bc51a44..ead7a71 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/config/RedisConfiguration.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/config/RedisConfiguration.java @@ -21,7 +21,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.boot.data.redis.autoconfigure.DataRedisAutoConfiguration; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -36,7 +36,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; */ @EnableCaching @AutoConfiguration -@AutoConfigureBefore(RedisAutoConfiguration.class) +@AutoConfigureBefore(DataRedisAutoConfiguration.class) public class RedisConfiguration { /** diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConversionService.java b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConversionService.java index f946200..016fa19 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConversionService.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConversionService.java @@ -2,7 +2,7 @@ package org.springblade.core.tool.convert; import org.springframework.boot.convert.ApplicationConversionService; import org.springframework.core.convert.support.GenericConversionService; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.StringValueResolver; /** diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConverter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConverter.java index b0af763..0bfa281 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConverter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/BladeConverter.java @@ -8,7 +8,7 @@ import org.springblade.core.tool.utils.ConvertUtil; import org.springblade.core.tool.utils.ReflectUtil; import org.springframework.cglib.core.Converter; import org.springframework.core.convert.TypeDescriptor; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.lang.reflect.Field; import java.util.concurrent.ConcurrentHashMap; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/EnumToStringConverter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/EnumToStringConverter.java index a7a2b2d..bb4de7b 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/EnumToStringConverter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/EnumToStringConverter.java @@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.ConvertUtil; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/StringToEnumConverter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/StringToEnumConverter.java index 9574adf..92d3d37 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/convert/StringToEnumConverter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/convert/StringToEnumConverter.java @@ -6,7 +6,7 @@ import org.springblade.core.tool.utils.ConvertUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.ConditionalGenericConverter; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java index 12828c6..fc10ae0 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.function; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serializable; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedConsumer.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedConsumer.java index 61f60df..f4087d4 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedConsumer.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedConsumer.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.function; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serializable; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedFunction.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedFunction.java index ebaab0e..2e55991 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedFunction.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedFunction.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.function; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serializable; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java index dbdae1e..77e1945 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.function; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serializable; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/AbstractReadWriteJackson2HttpMessageConverter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/AbstractReadWriteJackson2HttpMessageConverter.java index 6efe5eb..4e1520d 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/AbstractReadWriteJackson2HttpMessageConverter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/AbstractReadWriteJackson2HttpMessageConverter.java @@ -31,7 +31,7 @@ import org.springframework.http.converter.HttpMessageConversionException; import org.springframework.http.converter.HttpMessageNotWritableException; import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; import org.springframework.http.converter.json.MappingJacksonValue; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.TypeUtils; import java.io.IOException; @@ -45,6 +45,7 @@ import java.util.concurrent.atomic.AtomicReference; * * @author L.cm */ +@SuppressWarnings("removal") public abstract class AbstractReadWriteJackson2HttpMessageConverter extends AbstractJackson2HttpMessageConverter { private static final java.nio.charset.Charset DEFAULT_CHARSET = Charsets.UTF_8; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/BladeViewResponseAdvice.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/BladeViewResponseAdvice.java index 0622e96..21744e5 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/BladeViewResponseAdvice.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/BladeViewResponseAdvice.java @@ -23,8 +23,8 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJacksonValue; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; @@ -40,6 +40,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; @AutoIgnore @ControllerAdvice @RequiredArgsConstructor +@SuppressWarnings("removal") public class BladeViewResponseAdvice implements ResponseBodyAdvice { private final BladeViewResolver viewResolver; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java index da43db1..e45365f 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.type.CollectionLikeType; import com.fasterxml.jackson.databind.type.MapType; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.*; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; import java.io.InputStream; @@ -280,7 +280,7 @@ public class JsonUtil { * @return Bean */ @Nullable - public static T readValue(@Nullable byte[] content, Class valueType) { + public static T readValue(byte @Nullable [] content, Class valueType) { if (ObjectUtil.isEmpty(content)) { return null; } @@ -340,7 +340,7 @@ public class JsonUtil { * @return Bean */ @Nullable - public static T readValue(@Nullable byte[] content, TypeReference typeReference) { + public static T readValue(byte @Nullable [] content, TypeReference typeReference) { if (ObjectUtil.isEmpty(content)) { return null; } @@ -414,7 +414,7 @@ public class JsonUtil { * @return Bean */ @Nullable - public static T readValue(@Nullable byte[] content, JavaType javaType) { + public static T readValue(byte @Nullable [] content, JavaType javaType) { if (content == null || content.length == 0) { return null; } @@ -565,7 +565,7 @@ public class JsonUtil { * @param 泛型 * @return 集合 */ - public static List readList(@Nullable byte[] content, Class elementClass) { + public static List readList(byte @Nullable [] content, Class elementClass) { if (content == null || content.length == 0) { return Collections.emptyList(); } @@ -639,7 +639,7 @@ public class JsonUtil { * @param content bytes * @return 集合 */ - public static Map readMap(@Nullable byte[] content) { + public static Map readMap(byte @Nullable [] content) { return readMap(content, Object.class); } @@ -681,7 +681,7 @@ public class JsonUtil { * @param 泛型 * @return 集合 */ - public static Map readMap(@Nullable byte[] content, Class valueClass) { + public static Map readMap(byte @Nullable [] content, Class valueClass) { return readMap(content, String.class, valueClass); } @@ -731,7 +731,7 @@ public class JsonUtil { * @param 泛型 * @return 集合 */ - public static Map readMap(@Nullable byte[] content, Class keyClass, Class valueClass) { + public static Map readMap(byte @Nullable [] content, Class keyClass, Class valueClass) { if (content == null || content.length == 0) { return Collections.emptyMap(); } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/MappingApiJackson2HttpMessageConverter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/MappingApiJackson2HttpMessageConverter.java index 816e150..5aba270 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/MappingApiJackson2HttpMessageConverter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/MappingApiJackson2HttpMessageConverter.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.http.MediaType; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.IOException; import java.util.ArrayList; @@ -35,6 +35,7 @@ import java.util.List; * * @author L.cm */ +@SuppressWarnings("deprecation") public class MappingApiJackson2HttpMessageConverter extends AbstractReadWriteJackson2HttpMessageConverter { @Nullable diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/redis/RedisKeySerializer.java b/blade-core-tool/src/main/java/org/springblade/core/tool/redis/RedisKeySerializer.java index a1dc06b..8a84ba1 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/redis/RedisKeySerializer.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/redis/RedisKeySerializer.java @@ -19,7 +19,7 @@ import org.springframework.cache.interceptor.SimpleKey; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -58,8 +58,7 @@ public class RedisKeySerializer implements RedisSerializer { } @Override - @Nullable - public byte[] serialize(Object object) { + public byte @Nullable [] serialize(Object object) { Objects.requireNonNull(object, "redis key is null"); String key; if (object instanceof SimpleKey) { diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/support/FastStringWriter.java b/blade-core-tool/src/main/java/org/springblade/core/tool/support/FastStringWriter.java index 4f15919..82451eb 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/support/FastStringWriter.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/support/FastStringWriter.java @@ -1,7 +1,7 @@ package org.springblade.core.tool.support; import org.springblade.core.tool.utils.StringPool; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Writer; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/AesUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/AesUtil.java index fe8e516..bad5d93 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/AesUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/AesUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import javax.crypto.Cipher; @@ -145,8 +145,7 @@ public class AesUtil { * @param aesTextKey 文本密钥 * @return byte[] */ - @Nullable - public static byte[] decryptFormHex(@Nullable String content, String aesTextKey) { + public static byte @Nullable [] decryptFormHex(@Nullable String content, String aesTextKey) { if (StringUtil.isBlank(content)) { return null; } @@ -187,8 +186,7 @@ public class AesUtil { * @param aesTextKey 文本密钥 * @return byte[] */ - @Nullable - public static byte[] decryptFormBase64(@Nullable String content, String aesTextKey) { + public static byte @Nullable [] decryptFormBase64(@Nullable String content, String aesTextKey) { if (StringUtil.isBlank(content)) { return null; } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CollectionUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CollectionUtil.java index a4fb470..f7370bb 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CollectionUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/CollectionUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.CollectionUtils; import java.util.Arrays; @@ -38,7 +38,7 @@ public class CollectionUtil extends org.springframework.util.CollectionUtils { * @param The generic tag * @return {@code true} if found, {@code false} else */ - public static boolean contains(@Nullable T[] array, final T element) { + public static boolean contains(T @Nullable [] array, final T element) { if (array == null) { return false; } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ConvertUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ConvertUtil.java index 12344e6..80f9133 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ConvertUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ConvertUtil.java @@ -4,7 +4,7 @@ import lombok.experimental.UtilityClass; import org.springblade.core.tool.convert.BladeConversionService; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.support.GenericConversionService; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; /** * 基于 spring ConversionService 类型转换 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesUtil.java index 95713ed..079e8fa 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import javax.crypto.Cipher; import javax.crypto.SecretKeyFactory; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesensitizationUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesensitizationUtil.java index 9cbff18..a3d4ba0 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesensitizationUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DesensitizationUtil.java @@ -17,7 +17,7 @@ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.StringUtils; import java.util.Arrays; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DigestUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DigestUtil.java index 994fa6c..b6a6551 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DigestUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/DigestUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import javax.crypto.Mac; import javax.crypto.SecretKey; @@ -421,7 +421,7 @@ public class DigestUtil extends org.springframework.util.DigestUtils { return slowEquals(a.getBytes(Charsets.UTF_8), b.getBytes(Charsets.UTF_8)); } - public static boolean slowEquals(@Nullable byte[] a, @Nullable byte[] b) { + public static boolean slowEquals(byte @Nullable [] a, byte @Nullable [] b) { if (a == null || b == null) { return false; } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/FileUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/FileUtil.java index d848915..b5627e1 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/FileUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/FileUtil.java @@ -17,7 +17,7 @@ package org.springblade.core.tool.utils; import lombok.experimental.UtilityClass; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import org.springframework.util.FileSystemUtils; import org.springframework.util.PatternMatchUtils; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java index 3943727..daf3ad8 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Func.java @@ -22,7 +22,7 @@ import org.springblade.core.tool.jackson.JsonUtil; import org.springframework.beans.BeansException; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.StringUtils; import org.springframework.web.method.HandlerMethod; @@ -268,7 +268,7 @@ public class Func { * @param array the array to check * @return 数组是否为空 */ - public static boolean isEmpty(@Nullable Object[] array) { + public static boolean isEmpty(Object @Nullable [] array) { return ObjectUtil.isEmpty(array); } @@ -278,7 +278,7 @@ public class Func { * @param array 数组 * @return 数组是否不为空 */ - public static boolean isNotEmpty(@Nullable Object[] array) { + public static boolean isNotEmpty(Object @Nullable [] array) { return ObjectUtil.isNotEmpty(array); } @@ -348,7 +348,7 @@ public class Func { * @param The generic tag * @return {@code true} if found, {@code false} else */ - public static boolean contains(@Nullable T[] array, final T element) { + public static boolean contains(T @Nullable [] array, final T element) { return CollectionUtil.contains(array, element); } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/HexUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/HexUtil.java index 6d08fba..074ab97 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/HexUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/HexUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.nio.charset.Charset; @@ -107,8 +107,7 @@ public class HexUtil { * @param data Hex data * @return decode hex to bytes */ - @Nullable - public static byte[] decode(@Nullable String data) { + public static byte @Nullable [] decode(@Nullable String data) { if (StringUtil.isBlank(data)) { return null; } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/IoUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/IoUtil.java index 70236d3..9e0b65b 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/IoUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/IoUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Closeable; import java.io.IOException; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Lazy.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Lazy.java index 923aa0c..c4db2fc 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Lazy.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/Lazy.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.Serializable; import java.util.function.Supplier; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/NumberUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/NumberUtil.java index 03ad8e0..83bc397 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/NumberUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/NumberUtil.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; /** * 数字类型工具类 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ObjectUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ObjectUtil.java index 8c41d62..cbabdfa 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ObjectUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ObjectUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; /** * 对象工具类 diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/PathUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/PathUtil.java index 25ce080..b1a79ca 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/PathUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/PathUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.io.File; import java.net.URL; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ReflectUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ReflectUtil.java index 6b54d02..85a9f10 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ReflectUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/ReflectUtil.java @@ -5,7 +5,7 @@ import org.springframework.beans.BeansException; import org.springframework.cglib.core.CodeGenerationException; import org.springframework.core.convert.Property; import org.springframework.core.convert.TypeDescriptor; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.ReflectionUtils; import java.beans.PropertyDescriptor; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/RegexUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/RegexUtil.java index 87d2d62..45b0661 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/RegexUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/RegexUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/StringUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/StringUtil.java index 95245dc..abdc9db 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/StringUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/StringUtil.java @@ -16,7 +16,7 @@ package org.springblade.core.tool.utils; import org.springblade.core.tool.support.StrSpliter; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.web.util.HtmlUtils; @@ -337,7 +337,7 @@ public class StringUtil extends org.springframework.util.StringUtils { * @param arguments 需要替换的变量 * @return 转换后的字符串 */ - public static String format(@Nullable String message, @Nullable Object... arguments) { + public static String format(@Nullable String message, Object @Nullable ... arguments) { // message 为 null 返回空字符串 if (message == null) { return StringPool.EMPTY; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/WebUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/WebUtil.java index 84d265e..8903dec 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/WebUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/WebUtil.java @@ -18,7 +18,7 @@ package org.springblade.core.tool.utils; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.jackson.JsonUtil; import org.springframework.http.MediaType; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.request.RequestAttributes; diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/XmlUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/XmlUtil.java index 286e482..6850003 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/XmlUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/XmlUtil.java @@ -15,7 +15,7 @@ */ package org.springblade.core.tool.utils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; diff --git a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptParamResolver.java b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptParamResolver.java index f0a4a83..7482361 100644 --- a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptParamResolver.java +++ b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptParamResolver.java @@ -26,7 +26,7 @@ import org.springblade.core.tool.utils.Charsets; import org.springblade.core.tool.utils.StringUtil; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import org.springframework.web.bind.support.WebDataBinderFactory; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; diff --git a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptRequestBodyAdvice.java b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptRequestBodyAdvice.java index 28075c0..858e53f 100644 --- a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptRequestBodyAdvice.java +++ b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiDecryptRequestBodyAdvice.java @@ -15,7 +15,7 @@ import org.springframework.core.MethodParameter; import org.springframework.core.annotation.Order; import org.springframework.http.HttpInputMessage; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.lang.NonNull; +import org.jspecify.annotations.NonNull; import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice; diff --git a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiEncryptResponseBodyAdvice.java b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiEncryptResponseBodyAdvice.java index a491d54..d71c1b9 100644 --- a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiEncryptResponseBodyAdvice.java +++ b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/core/ApiEncryptResponseBodyAdvice.java @@ -16,8 +16,8 @@ import org.springframework.core.annotation.Order; import org.springframework.http.MediaType; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; diff --git a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/util/ApiCryptoUtil.java b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/util/ApiCryptoUtil.java index bade259..0abf9bb 100644 --- a/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/util/ApiCryptoUtil.java +++ b/blade-starter-api-crypto/src/main/java/org/springblade/core/api/crypto/util/ApiCryptoUtil.java @@ -13,7 +13,7 @@ import org.springblade.core.tool.utils.ClassUtil; import org.springblade.core.tool.utils.DesUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.core.MethodParameter; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; /** *

辅助检测工具类

diff --git a/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java b/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java index 16390b1..43f8981 100644 --- a/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java +++ b/blade-starter-cache/src/main/java/org/springblade/core/cache/utils/CacheUtil.java @@ -19,7 +19,7 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; import java.util.concurrent.Callable; diff --git a/blade-starter-develop/src/main/java/org/springblade/develop/CodeGenerator.java b/blade-starter-develop/src/main/java/org/springblade/develop/CodeGenerator.java index c8bf94a..9e7ea8c 100644 --- a/blade-starter-develop/src/main/java/org/springblade/develop/CodeGenerator.java +++ b/blade-starter-develop/src/main/java/org/springblade/develop/CodeGenerator.java @@ -37,10 +37,6 @@ public class CodeGenerator { * 代码生成的包名 */ public static String PACKAGE_NAME = "org.springblade.test"; - /** - * 前端代码生成所属系统 - */ - public static String SYSTEM_NAME = "saber"; /** * 前端代码生成地址 */ @@ -77,7 +73,6 @@ public class CodeGenerator { BladeCodeGenerator generator = new BladeCodeGenerator(); generator.setCodeName(CODE_NAME); generator.setServiceName(SERVICE_NAME); - generator.setSystemName(SYSTEM_NAME); generator.setPackageName(PACKAGE_NAME); generator.setPackageWebDir(PACKAGE_WEB_DIR); generator.setTablePrefix(TABLE_PREFIX); diff --git a/blade-starter-develop/src/main/java/org/springblade/develop/constant/DevelopConstant.java b/blade-starter-develop/src/main/java/org/springblade/develop/constant/DevelopConstant.java deleted file mode 100644 index fe4c932..0000000 --- a/blade-starter-develop/src/main/java/org/springblade/develop/constant/DevelopConstant.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com). - *

- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.gnu.org/licenses/lgpl.html - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springblade.develop.constant; - -/** - * 系统常量. - * - * @author zhuangqian - */ -public interface DevelopConstant { - /** - * sword 系统名 - */ - String SWORD_NAME = "sword"; - - /** - * saber 系统名 - */ - String SABER_NAME = "saber"; - - /** - * saber3 系统名 - */ - String SABER3_NAME = "saber3"; -} diff --git a/blade-starter-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java b/blade-starter-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java index 6fc63c4..f236910 100644 --- a/blade-starter-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java +++ b/blade-starter-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java @@ -19,7 +19,6 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.generator.FastAutoGenerator; import com.baomidou.mybatisplus.generator.config.OutputFile; -import com.baomidou.mybatisplus.generator.config.TemplateType; import com.baomidou.mybatisplus.generator.config.builder.CustomFile; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.DateType; @@ -28,9 +27,9 @@ import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Mapper; +import org.jspecify.annotations.NonNull; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; -import org.springblade.develop.constant.DevelopConstant; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PropertiesLoaderUtils; @@ -50,14 +49,14 @@ import java.util.Properties; @Data @Slf4j public class BladeCodeGenerator { - /** - * 代码所在系统 - */ - private String systemName = DevelopConstant.SABER3_NAME; /** * 代码模块名称 */ private String codeName; + /** + * 代码所在系统 + */ + private String systemName = "Saber"; /** * 代码所在服务名 */ @@ -141,54 +140,40 @@ public class BladeCodeGenerator { customMap.put("tenantColumn", tenantColumn); customMap.put("hasWrapper", hasWrapper); customMap.put("hasServiceName", hasServiceName); - Map customFile = new HashMap<>(15); + Map customFile = new HashMap<>(8); customFile.put("menu.sql", "/templates/sql/menu.sql.vm"); - customFile.put("entityVO.java", "/templates/entityVO.java.vm"); - customFile.put("entityDTO.java", "/templates/entityDTO.java.vm"); + customFile.put("entityVO.java", "/templates/api/entityVO.java.vm"); + customFile.put("entityDTO.java", "/templates/api/entityDTO.java.vm"); if (hasWrapper) { - customFile.put("wrapper.java", "/templates/wrapper.java.vm"); + customFile.put("wrapper.java", "/templates/api/wrapper.java.vm"); } if (Func.isNotBlank(packageWebDir)) { - if (Func.equals(systemName, DevelopConstant.SWORD_NAME)) { - customFile.put("action.js", "/templates/sword/action.js.vm"); - customFile.put("model.js", "/templates/sword/model.js.vm"); - customFile.put("service.js", "/templates/sword/service.js.vm"); - customFile.put("list.js", "/templates/sword/list.js.vm"); - customFile.put("add.js", "/templates/sword/add.js.vm"); - customFile.put("edit.js", "/templates/sword/edit.js.vm"); - customFile.put("view.js", "/templates/sword/view.js.vm"); - } else if (Func.equals(systemName, DevelopConstant.SABER_NAME)) { - customFile.put("api.js", "/templates/saber/api.js.vm"); - customFile.put("crud.vue", "/templates/saber/crud.vue.vm"); - } else if (Func.equals(systemName, DevelopConstant.SABER3_NAME)) { - customFile.put("api.js", "/templates/saber3/api.js.vm"); - customFile.put("crud.vue", "/templates/saber3/crud.vue.vm"); - } + customFile.put("api.js", "/templates/saber/api.js.vm"); + customFile.put("crud.vue", "/templates/saber/crud.vue.vm"); } FastAutoGenerator.create(url, username, password) .globalConfig(builder -> builder.author(props.getProperty("author")).dateType(DateType.TIME_PACK).enableSwagger().outputDir(getOutputDir()).disableOpenDir()) - .packageConfig(builder -> builder.parent(packageName).controller("controller").entity("entity").service("service").serviceImpl("service.impl").mapper("mapper").xml("mapper")) + .packageConfig(builder -> builder.parent(packageName).controller("controller").entity("pojo.entity").service("service").serviceImpl("service.impl").mapper("mapper").xml("mapper")) .strategyConfig(builder -> builder.addTablePrefix(tablePrefix).addInclude(includeTables).addExclude(excludeTables) .entityBuilder().naming(NamingStrategy.underline_to_camel).columnNaming(NamingStrategy.underline_to_camel).enableLombok().superClass("org.springblade.core.mp.base.BaseEntity").addSuperEntityColumns(superEntityColumns).enableFileOverride() + .javaTemplate("/templates/api/entity.java.vm") .serviceBuilder().superServiceClass("org.springblade.core.mp.base.BaseService").superServiceImplClass("org.springblade.core.mp.base.BaseServiceImpl").formatServiceFileName("I%sService").formatServiceImplFileName("%sServiceImpl").enableFileOverride() + .serviceTemplate("/templates/api/service.java.vm") + .serviceImplTemplate("/templates/api/serviceImpl.java.vm") .mapperBuilder().mapperAnnotation(Mapper.class).enableBaseResultMap().enableBaseColumnList().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper").enableFileOverride() + .mapperTemplate("/templates/api/mapper.java.vm") + .mapperXmlTemplate("/templates/api/mapper.xml.vm") .controllerBuilder().superClass("org.springblade.core.boot.ctrl.BladeController").formatFileName("%sController").enableRestStyle().enableHyphenStyle().enableFileOverride() + .template("/templates/api/controller.java.vm") ) - .templateConfig(builder -> builder.disable(TemplateType.ENTITY) - .entity("/templates/entity.java.vm") - .service("/templates/service.java.vm") - .serviceImpl("/templates/serviceImpl.java.vm") - .mapper("/templates/mapper.java.vm") - .xml("/templates/mapper.xml.vm") - .controller("/templates/controller.java.vm")) .injectionConfig(builder -> builder.beforeOutputFile( (tableInfo, objectMap) -> System.out.println("tableInfo: " + tableInfo.getEntityName() + " objectMap: " + objectMap.size()) ).customMap(customMap).customFile(customFile) ) .templateEngine(new VelocityTemplateEngine() { @Override - protected void outputCustomFile(List customFiles, TableInfo tableInfo, Map objectMap) { + protected void outputCustomFile(@NonNull List customFiles, @NonNull TableInfo tableInfo, @NonNull Map objectMap) { String entityName = tableInfo.getEntityName(); String entityNameLower = tableInfo.getEntityName().toLowerCase(); @@ -206,45 +191,17 @@ public class BladeCodeGenerator { outputPath = getOutputDir() + StringPool.SLASH + "sql" + StringPool.SLASH + entityNameLower + ".menu.sql"; } if (StringUtil.equals(key, "entityVO.java")) { - outputPath = getOutputDir() + StringPool.SLASH + packageName.replace(StringPool.DOT, StringPool.SLASH) + StringPool.SLASH + "vo" + StringPool.SLASH + entityName + "VO" + StringPool.DOT_JAVA; + outputPath = getOutputDir() + StringPool.SLASH + packageName.replace(StringPool.DOT, StringPool.SLASH) + StringPool.SLASH + "pojo" + StringPool.SLASH + "vo" + StringPool.SLASH + entityName + "VO" + StringPool.DOT_JAVA; } if (StringUtil.equals(key, "entityDTO.java")) { - outputPath = getOutputDir() + StringPool.SLASH + packageName.replace(StringPool.DOT, StringPool.SLASH) + StringPool.SLASH + "dto" + StringPool.SLASH + entityName + "DTO" + StringPool.DOT_JAVA; + outputPath = getOutputDir() + StringPool.SLASH + packageName.replace(StringPool.DOT, StringPool.SLASH) + StringPool.SLASH + "pojo" + StringPool.SLASH + "dto" + StringPool.SLASH + entityName + "DTO" + StringPool.DOT_JAVA; } if (StringUtil.equals(key, "wrapper.java")) { outputPath = getOutputDir() + StringPool.SLASH + packageName.replace(StringPool.DOT, StringPool.SLASH) + StringPool.SLASH + "wrapper" + StringPool.SLASH + entityName + "Wrapper" + StringPool.DOT_JAVA; } - if (StringUtil.equals(key, "action.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "actions" + StringPool.SLASH + entityNameLower + ".js"; - } - - if (StringUtil.equals(key, "model.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "models" + StringPool.SLASH + entityNameLower + ".js"; - } - - if (StringUtil.equals(key, "service.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "services" + StringPool.SLASH + entityNameLower + ".js"; - } - - if (StringUtil.equals(key, "list.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "pages" + StringPool.SLASH + StringUtil.upperFirst(servicePackage) + StringPool.SLASH + entityName + StringPool.SLASH + entityName + ".js"; - } - - if (StringUtil.equals(key, "add.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "pages" + StringPool.SLASH + StringUtil.upperFirst(servicePackage) + StringPool.SLASH + entityName + StringPool.SLASH + entityName + "Add.js"; - } - - if (StringUtil.equals(key, "edit.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "pages" + StringPool.SLASH + StringUtil.upperFirst(servicePackage) + StringPool.SLASH + entityName + StringPool.SLASH + entityName + "Edit.js"; - } - - if (StringUtil.equals(key, "view.js")) { - outputPath = getOutputWebDir() + StringPool.SLASH + "pages" + StringPool.SLASH + StringUtil.upperFirst(servicePackage) + StringPool.SLASH + entityName + StringPool.SLASH + entityName + "View.js"; - } - if (StringUtil.equals(key, "api.js")) { outputPath = getOutputWebDir() + StringPool.SLASH + "api" + StringPool.SLASH + servicePackage.toLowerCase() + StringPool.SLASH + entityNameLower + ".js"; } @@ -260,7 +217,6 @@ public class BladeCodeGenerator { } - /** * 获取配置文件 * diff --git a/blade-starter-develop/src/main/resources/templates/controller.java.vm b/blade-starter-develop/src/main/resources/templates/api/controller.java.vm similarity index 92% rename from blade-starter-develop/src/main/resources/templates/controller.java.vm rename to blade-starter-develop/src/main/resources/templates/api/controller.java.vm index a8e45ba..94b7235 100644 --- a/blade-starter-develop/src/main/resources/templates/controller.java.vm +++ b/blade-starter-develop/src/main/resources/templates/api/controller.java.vm @@ -18,12 +18,12 @@ package $!{package.Controller}; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import jakarta.validation.Valid; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.swagger.annotation.ApiOrder; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; @@ -34,7 +34,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import $!{package.Entity}.$!{entity}; #set($voPackage=$package.Entity.replace("entity","vo")) import $!{voPackage}.$!{entity}VO; -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) +#set($wrapperPackage=$package.Entity.replace("pojo.entity","wrapper")) #if($!{hasWrapper}) import $!{wrapperPackage}.$!{entity}Wrapper; #end @@ -54,6 +54,7 @@ import $!{superControllerClassPackage}; @RestController @AllArgsConstructor @RequestMapping("#if($!{hasServiceName})/$!{serviceName}#end/$!{entityKey}") +@ApiOrder @Tag(name = "$!{table.comment}", description = "$!{table.comment}接口") #if($!{superControllerClass}) public class $!{table.controllerName} extends $!{superControllerClass} { @@ -68,7 +69,6 @@ public class $!{table.controllerName} { * 详情 */ @GetMapping("/detail") - @ApiOperationSupport(order = 1) @Operation(summary = "详情", description = "传入$!{table.entityPath}") public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) { $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath})); @@ -79,7 +79,6 @@ public class $!{table.controllerName} { * 分页 $!{table.comment} */ @GetMapping("/list") - @ApiOperationSupport(order = 2) @Operation(summary = "分页", description = "传入$!{table.entityPath}") public R> list($!{entity} $!{table.entityPath}, Query query) { IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath})); @@ -91,7 +90,6 @@ public class $!{table.controllerName} { * 详情 */ @GetMapping("/detail") - @ApiOperationSupport(order = 1) @Operation(summary = "详情", description = "传入$!{table.entityPath}") public R<$!{entity}> detail($!{entity} $!{table.entityPath}) { $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath})); @@ -102,7 +100,6 @@ public class $!{table.controllerName} { * 分页 $!{table.comment} */ @GetMapping("/list") - @ApiOperationSupport(order = 2) @Operation(summary = "分页", description = "传入$!{table.entityPath}") public R> list($!{entity} $!{table.entityPath}, Query query) { IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath})); @@ -114,7 +111,6 @@ public class $!{table.controllerName} { * 自定义分页 $!{table.comment} */ @GetMapping("/page") - @ApiOperationSupport(order = 3) @Operation(summary = "分页", description = "传入$!{table.entityPath}") public R> page($!{entity}VO $!{table.entityPath}, Query query) { IPage<$!{entity}VO> pages = $!{table.entityPath}Service.select$!{entity}Page(Condition.getPage(query), $!{table.entityPath}); @@ -125,7 +121,6 @@ public class $!{table.controllerName} { * 新增 $!{table.comment} */ @PostMapping("/save") - @ApiOperationSupport(order = 4) @Operation(summary = "新增", description = "传入$!{table.entityPath}") public R save(@Valid @RequestBody $!{entity} $!{table.entityPath}) { return R.status($!{table.entityPath}Service.save($!{table.entityPath})); @@ -135,7 +130,6 @@ public class $!{table.controllerName} { * 修改 $!{table.comment} */ @PostMapping("/update") - @ApiOperationSupport(order = 5) @Operation(summary = "修改", description = "传入$!{table.entityPath}") public R update(@Valid @RequestBody $!{entity} $!{table.entityPath}) { return R.status($!{table.entityPath}Service.updateById($!{table.entityPath})); @@ -145,7 +139,6 @@ public class $!{table.controllerName} { * 新增或修改 $!{table.comment} */ @PostMapping("/submit") - @ApiOperationSupport(order = 6) @Operation(summary = "新增或修改", description = "传入$!{table.entityPath}") public R submit(@Valid @RequestBody $!{entity} $!{table.entityPath}) { return R.status($!{table.entityPath}Service.saveOrUpdate($!{table.entityPath})); @@ -157,7 +150,6 @@ public class $!{table.controllerName} { * 删除 $!{table.comment} */ @PostMapping("/remove") - @ApiOperationSupport(order = 7) @Operation(summary = "逻辑删除", description = "传入ids") public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { return R.status($!{table.entityPath}Service.deleteLogic(Func.toLongList(ids))); @@ -169,7 +161,6 @@ public class $!{table.controllerName} { * 删除 $!{table.comment} */ @PostMapping("/remove") - @ApiOperationSupport(order = 8) @Operation(summary = "删除", description = "传入ids") public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { return R.status($!{table.entityPath}Service.removeByIds(Func.toLongList(ids))); diff --git a/blade-starter-develop/src/main/resources/templates/entity.java.vm b/blade-starter-develop/src/main/resources/templates/api/entity.java.vm similarity index 69% rename from blade-starter-develop/src/main/resources/templates/entity.java.vm rename to blade-starter-develop/src/main/resources/templates/api/entity.java.vm index 9fa42c2..d349d24 100644 --- a/blade-starter-develop/src/main/resources/templates/entity.java.vm +++ b/blade-starter-develop/src/main/resources/templates/api/entity.java.vm @@ -54,7 +54,7 @@ public class $!{entity} extends Model<$!{entity}> { public class $!{entity} implements Serializable { #end - @Serial + @Serial private static final long serialVersionUID = 1L; ## ---------- BEGIN 字段循环遍历 ---------- @@ -64,42 +64,42 @@ public class $!{entity} implements Serializable { #set($keyPropertyName=$!{field.propertyName}) #end #if("$!field.comment" != "") - /** - * $!{field.comment} - */ + /** + * $!{field.comment} + */ #if($!{swagger}) - @Schema(description = "$!{field.comment}") + @Schema(description = "$!{field.comment}") #end #end #if($!{field.keyFlag}) ## 主键 #if($!{field.keyIdentityFlag}) - @TableId(value = "$!{field.name}", type = IdType.AUTO) + @TableId(value = "$!{field.name}", type = IdType.AUTO) #elseif(!$null.isNull($!{idType}) && "$!idType" != "") - @TableId(value = "$!{field.name}", type = IdType.$!{idType}) + @TableId(value = "$!{field.name}", type = IdType.$!{idType}) #elseif($!{field.convert}) - @TableId("$!{field.name}") + @TableId("$!{field.name}") #end ## 普通字段 #elseif($!{field.fill}) ## ----- 存在字段填充设置 ----- #if($!{field.convert}) - @TableField(value = "$!{field.name}", fill = FieldFill.$!{field.fill}) + @TableField(value = "$!{field.name}", fill = FieldFill.$!{field.fill}) #else - @TableField(fill = FieldFill.$!{field.fill}) + @TableField(fill = FieldFill.$!{field.fill}) #end #elseif($!{field.convert}) - @TableField("$!{field.name}") + @TableField("$!{field.name}") #end ## 乐观锁注解 #if($!{versionFieldName}==$!{field.name}) - @Version + @Version #end ## 逻辑删除注解 #if($!{logicDeleteFieldName}==$!{field.name}) - @TableLogic + @TableLogic #end - private $!{field.propertyType} $!{field.propertyName}; + private $!{field.propertyType} $!{field.propertyName}; #end #end ## ---------- END 字段循环遍历 ---------- @@ -112,52 +112,52 @@ public class $!{entity} implements Serializable { #set($getprefix="get") #end - public $!{field.propertyType} $!{getprefix}$!{field.capitalName}() { - return $!{field.propertyName}; - } + public $!{field.propertyType} $!{getprefix}$!{field.capitalName}() { + return $!{field.propertyName}; + } #if($!{entityBuilderModel}) - public $!{entity} set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { + public $!{entity} set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { #else - public void set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { + public void set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { #end - this.$!{field.propertyName} = $!{field.propertyName}; + this.$!{field.propertyName} = $!{field.propertyName}; #if($!{entityBuilderModel}) - return this; + return this; #end - } + } #end #end #if($!{entityColumnConstant}) #foreach($field in $!{table.fields}) - public static final String $!{field.name.toUpperCase()} = "$!{field.name}"; + public static final String $!{field.name.toUpperCase()} = "$!{field.name}"; #end #end #if($!{activeRecord}) - @Override - protected Serializable pkVal() { + @Override + protected Serializable pkVal() { #if($!{keyPropertyName}) - return this.$!{keyPropertyName}; + return this.$!{keyPropertyName}; #else - return this.id; + return this.id; #end - } + } #end #if(!$!{entityLombokModel}) - @Override - public String toString() { - return "$!{entity}{" + + @Override + public String toString() { + return "$!{entity}{" + #foreach($field in $!{table.fields}) #if($!{velocityCount}==1) - "$!{field.propertyName}=" + $!{field.propertyName} + + "$!{field.propertyName}=" + $!{field.propertyName} + #else - ", $!{field.propertyName}=" + $!{field.propertyName} + + ", $!{field.propertyName}=" + $!{field.propertyName} + #end #end - "}"; - } + "}"; + } #end } diff --git a/blade-starter-develop/src/main/resources/templates/entityDTO.java.vm b/blade-starter-develop/src/main/resources/templates/api/entityDTO.java.vm similarity index 100% rename from blade-starter-develop/src/main/resources/templates/entityDTO.java.vm rename to blade-starter-develop/src/main/resources/templates/api/entityDTO.java.vm diff --git a/blade-starter-develop/src/main/resources/templates/entityVO.java.vm b/blade-starter-develop/src/main/resources/templates/api/entityVO.java.vm similarity index 100% rename from blade-starter-develop/src/main/resources/templates/entityVO.java.vm rename to blade-starter-develop/src/main/resources/templates/api/entityVO.java.vm diff --git a/blade-starter-develop/src/main/resources/templates/mapper.java.vm b/blade-starter-develop/src/main/resources/templates/api/mapper.java.vm similarity index 90% rename from blade-starter-develop/src/main/resources/templates/mapper.java.vm rename to blade-starter-develop/src/main/resources/templates/api/mapper.java.vm index 9350450..d3f99f9 100644 --- a/blade-starter-develop/src/main/resources/templates/mapper.java.vm +++ b/blade-starter-develop/src/main/resources/templates/api/mapper.java.vm @@ -36,9 +36,9 @@ public interface $!{table.mapperName} extends $!{superMapperClass}<$!{entity}> { /** * 自定义分页 * - * @param page - * @param $!{table.entityPath} - * @return + * @param page 分页参数 + * @param $!{table.entityPath} $!{table.comment}查询条件 + * @return $!{table.comment}分页数据 */ List<$!{entity}VO> select$!{entity}Page(IPage page, $!{entity}VO $!{table.entityPath}); diff --git a/blade-starter-develop/src/main/resources/templates/mapper.xml.vm b/blade-starter-develop/src/main/resources/templates/api/mapper.xml.vm similarity index 100% rename from blade-starter-develop/src/main/resources/templates/mapper.xml.vm rename to blade-starter-develop/src/main/resources/templates/api/mapper.xml.vm diff --git a/blade-starter-develop/src/main/resources/templates/service.java.vm b/blade-starter-develop/src/main/resources/templates/api/service.java.vm similarity index 90% rename from blade-starter-develop/src/main/resources/templates/service.java.vm rename to blade-starter-develop/src/main/resources/templates/api/service.java.vm index a2453d4..c7784e4 100644 --- a/blade-starter-develop/src/main/resources/templates/service.java.vm +++ b/blade-starter-develop/src/main/resources/templates/api/service.java.vm @@ -35,9 +35,9 @@ public interface $!{table.serviceName} extends $!{superServiceClass}<$!{entity}> /** * 自定义分页 * - * @param page - * @param $!{table.entityPath} - * @return + * @param page 分页参数 + * @param $!{table.entityPath} $!{table.comment}查询条件 + * @return $!{table.comment}分页数据 */ IPage<$!{entity}VO> select$!{entity}Page(IPage<$!{entity}VO> page, $!{entity}VO $!{table.entityPath}); diff --git a/blade-starter-develop/src/main/resources/templates/serviceImpl.java.vm b/blade-starter-develop/src/main/resources/templates/api/serviceImpl.java.vm similarity index 100% rename from blade-starter-develop/src/main/resources/templates/serviceImpl.java.vm rename to blade-starter-develop/src/main/resources/templates/api/serviceImpl.java.vm diff --git a/blade-starter-develop/src/main/resources/templates/wrapper.java.vm b/blade-starter-develop/src/main/resources/templates/api/wrapper.java.vm similarity index 92% rename from blade-starter-develop/src/main/resources/templates/wrapper.java.vm rename to blade-starter-develop/src/main/resources/templates/api/wrapper.java.vm index 4c331cd..dc8422d 100644 --- a/blade-starter-develop/src/main/resources/templates/wrapper.java.vm +++ b/blade-starter-develop/src/main/resources/templates/api/wrapper.java.vm @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) +#set($wrapperPackage=$package.Entity.replace("pojo.entity","wrapper")) package $!{wrapperPackage}; import lombok.AllArgsConstructor; @@ -31,7 +31,7 @@ import $!{voPackage}.$!{entity}VO; */ public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> { - public static $!{entity}Wrapper build() { + public static $!{entity}Wrapper build() { return new $!{entity}Wrapper(); } diff --git a/blade-starter-develop/src/main/resources/templates/saber/api.js.vm b/blade-starter-develop/src/main/resources/templates/saber/api.js.vm index 67cd22c..995ad2e 100644 --- a/blade-starter-develop/src/main/resources/templates/saber/api.js.vm +++ b/blade-starter-develop/src/main/resources/templates/saber/api.js.vm @@ -1,8 +1,8 @@ -import request from '@/router/axios'; +import request from '@/axios'; export const getList = (current, size, params) => { return request({ - url: '/api/$!{serviceName}/$!{entityKey}/list', + url: '/$!{serviceName}/$!{entityKey}/list', method: 'get', params: { ...params, @@ -14,7 +14,7 @@ export const getList = (current, size, params) => { export const getDetail = (id) => { return request({ - url: '/api/$!{serviceName}/$!{entityKey}/detail', + url: '/$!{serviceName}/$!{entityKey}/detail', method: 'get', params: { id @@ -24,7 +24,7 @@ export const getDetail = (id) => { export const remove = (ids) => { return request({ - url: '/api/$!{serviceName}/$!{entityKey}/remove', + url: '/$!{serviceName}/$!{entityKey}/remove', method: 'post', params: { ids, @@ -34,7 +34,7 @@ export const remove = (ids) => { export const add = (row) => { return request({ - url: '/api/$!{serviceName}/$!{entityKey}/submit', + url: '/$!{serviceName}/$!{entityKey}/submit', method: 'post', data: row }) @@ -42,7 +42,7 @@ export const add = (row) => { export const update = (row) => { return request({ - url: '/api/$!{serviceName}/$!{entityKey}/submit', + url: '/$!{serviceName}/$!{entityKey}/submit', method: 'post', data: row }) diff --git a/blade-starter-develop/src/main/resources/templates/saber/crud.vue.vm b/blade-starter-develop/src/main/resources/templates/saber/crud.vue.vm index 385d78a..2d99b1c 100644 --- a/blade-starter-develop/src/main/resources/templates/saber/crud.vue.vm +++ b/blade-starter-develop/src/main/resources/templates/saber/crud.vue.vm @@ -3,11 +3,12 @@ -