中台2024.1.0.0版本升级指南
Fst
此项操作应用于redis序列化缓存值,开发时添加到idea的VM options中,以便正常开发带redis缓存的工程
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.math=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED
--add-opens=java.base/java.time=ALL-UNNAMED
--add-opens=java.sql/java.sql=ALL-UNNAMED
spring.factories
替换为 spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
javax
import javax.servlet. -> import jakarta.servlet.
import javax.validation. -> import jakarta.validation.
import javax.annotation. -> import jakarta.annotation.
import javax.websocket. -> import jakarta.websocket.
mail:
import javax.mail -> .import jakarta.mail.
feign.hystrix.FallbackFactory
import feign.hystrix.FallbackFactory; -> import org.springframework.cloud.openfeign.FallbackFactory;
Swagger
替换前先将idea保存自动格式化及去除多余引用关闭,避免表达式内容替换完毕后,引入类无法替换的问题
Api
@Api\(value \= \"(.*)\"\, tags \= \"(.*)\"\) -> @Tag(name = "$2", description = "$1")
@Api\(tags \= \"(.*)\"\) -> @Tag(name = "$1")
@Api\(\"(.*)\"\) -> -> @Tag(name = "$1")
import io.swagger.annotations.Api; -> import io.swagger.v3.oas.annotations.tags.Tag;
ApiModel
@ApiModel\(value \= \"(.*)\"\) -> @Schema(description = "$1")
@ApiModel\(description \= \"(.*)\"\) -> @Schema(description = "$1")
@ApiModel\(\"(.*)\"\) -> @Schema(description = "$1")
import io.swagger.annotations.ApiModel; -> import io.swagger.v3.oas.annotations.media.Schema;
ApiModelProperty
@ApiModelProperty\(name \= \"(.*)\" -> @Schema(description = "$1"
@ApiModelProperty\(value \= \"(.*)\"\, required \= true\) -> @Schema(description = "$1", requiredMode = Schema.RequiredMode.REQUIRED)
@ApiModelProperty\(value \= \"(.*)\"\, required \= true\, -> @Schema(description = "$1", requiredMode = Schema.RequiredMode.REQUIRED,
@ApiModelProperty\(value \= \"(.*)\", -> @Schema(description = "$1",
@ApiModelProperty\(value \= \"(.*)\" -> @Schema(description = "$1"
@ApiModelProperty\(\"(.*)\"\) -> @Schema(description = "$1")
@Schema\((.*)dataType -> @Schema($1type
import io.swagger.annotations.ApiModelProperty; -> import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema; -> import io.swagger.v3.oas.annotations.media.Schema;
ApiOperation
@ApiOperation\(value = \"(.*)\", notes = \"(.*)\" -> @Operation(summary = "$1", description = "$2"
@ApiOperation\(value = \"(.*)\"\) -> @Operation(summary = "$1")
@ApiOperation\(\"(.*)\"\) -> @Operation(summary = "$1")
import io.swagger.annotations.ApiOperation; -> import io.swagger.v3.oas.annotations.Operation;
ApiImplicitParam
@ApiImplicitParam\(name \= \"(.*)\"\, value = \"(.*)\", defaultValue = \"(.*)\" -> @Parameter(name = "$1", description = "$2", example = "$3"
@ApiImplicitParam\(name \= \"(.*)\"\, required = true, value = \"(.*)\" -> @Parameter(name = "$1", description = "$2", required = true
@ApiImplicitParam\(name \= \"(.*)\"\, value = \"(.*)\" -> @Parameter(name = "$1", description = "$2"
@ApiImplicitParam\(value \= \"(.*)\"\, name = \"(.*)\" -> @Parameter(name = "$2", description = "$1"
@ApiImplicitParam\(value \= \"(.*)\"\, required = true, name = \"(.*)\" -> @Parameter(name = "$2", description = "$1", required = true
@Parameter\((.*)paramType \= \"path\" -> @Parameter($1in = ParameterIn.PATH
import io.swagger.annotations.ApiImplicitParam; -> import io.swagger.v3.oas.annotations.Parameter;
属性 dataType、type -> 未找到代替属性,估计是会根据参数自行判断,去除
注意:@PathVariable
需要将其对应的@Parameter删除,这样在swagger文档中才会出现对应参数的输入框
ApiImplicitParams
@ApiImplicitParams( -> @Parameters(
import io.swagger.annotations.ApiImplicitParams; -> import io.swagger.v3.oas.annotations.Parameters;
根据sonarlint提示,可以直接去除:@ApiImplicitParams
Other
@ApiIgnore → @Parameter(hidden = true) or @Operation(hidden = true) or @Hidden
@ApiOperationSupport -> 未找到替代注解,直接去除
XXLJob
XxlJobLogger -> XxlJobHelper
dozer
org.dozer.Mapping -> com.github.dozermapper.core.Mapping
org.dozer.DozerBeanMapperBuilder -> com.github.dozermapper.core.DozerBeanMapperBuilder
druid
# database、username、password到datasource下,druid.url则为以下固定模式
spring:
datasource:
database: pai_xxx
username: pai-xxx
password: ENC(xxxxxxxx)
druid:
url: ${spring.datasource.url-template}
redis
spring:
data: # 加多data前缀
redis: ...
@SpringColudApplication
// 替换为以下两个注解
@SpringBootApplication
@EnableDiscoveryClient
jdk版本指定
pom.xml
<properties>
<java.version>21</java.version>
</properties>
Dockerfile
FROM dev.flyrise.cn:8082/library/openjdk:8-jdk-alpine
替换为
FROM dev.flyrise.cn:8082/library/openjdk:21-alpine
去除行:ENV JVM_OPTS="-Djava.security.egd=file:/dev/./urandom"
Dockerfile 分层打包
加快镜像打包,以及镜像拉取的速度。
以下为完整示例,替换target/xxx.jar
为自身工程打包对应的jar即可。
ARG BASE=dev.flyrise.cn:8082/library/openjdk:21-alpine
FROM dev.flyrise.cn:8082/library/openjdk:21-jdk-amazoncorretto AS builder
WORKDIR /home/pai
COPY target/xxx.jar ./app.jar
RUN java -Djarmode=layertools -jar app.jar extract
FROM ${BASE}
WORKDIR /home/pai
COPY --from=builder /home/pai/dependencies/ ./
COPY --from=builder /home/pai/snapshot-dependencies/ ./
COPY --from=builder /home/pai/spring-boot-loader/ ./
COPY --from=builder /home/pai/application/ ./
ENV JAVA_OPTS=""
ENTRYPOINT ["sh","-c","java $JVM_OPTS $JAVA_OPTS org.springframework.boot.loader.launch.JarLauncher"]
其它未尽事宜,请在凌云讨论群中提出,或自行寻找替代方案
文档更新时间: 2024-10-17 15:25 作者:陆鸿睿