From 6ea0bab28787ec37cb329be271f3f178b4ebea24 Mon Sep 17 00:00:00 2001 From: gewuyou Date: Wed, 28 May 2025 23:49:28 +0800 Subject: [PATCH] refactor(webmvc): Refactored the WebMvc version module - Migrating Java code to Kotlin - Updating project structure and naming - Add Git-related files - Adjust the build configuration --- forgeboot-webmvc/version/.gitattributes | 3 ++ forgeboot-webmvc/version/.gitignore | 40 +++++++++++++++++++ .../build.gradle.kts | 2 +- .../webmvc/version/annotation/ApiVersion.kt | 0 .../config/VersionAutoConfiguration.kt | 0 .../entities/WebMvcVersionProperties.kt} | 35 +++++----------- .../ApiVersionRequestMappingHandlerMapping.kt | 0 ...ot.autoconfigure.AutoConfiguration.imports | 0 8 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 forgeboot-webmvc/version/.gitattributes create mode 100644 forgeboot-webmvc/version/.gitignore rename forgeboot-webmvc/{forgeboot-webmvc-version-starter => version}/build.gradle.kts (69%) rename forgeboot-webmvc/{forgeboot-webmvc-version-starter => version}/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/annotation/ApiVersion.kt (100%) rename forgeboot-webmvc/{forgeboot-webmvc-version-starter => version}/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/VersionAutoConfiguration.kt (100%) rename forgeboot-webmvc/{forgeboot-webmvc-version-starter/src/main/java/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.java => version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.kt} (52%) rename forgeboot-webmvc/{forgeboot-webmvc-version-starter => version}/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/mapping/ApiVersionRequestMappingHandlerMapping.kt (100%) rename forgeboot-webmvc/{forgeboot-webmvc-version-starter => version}/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports (100%) diff --git a/forgeboot-webmvc/version/.gitattributes b/forgeboot-webmvc/version/.gitattributes new file mode 100644 index 0000000..8af972c --- /dev/null +++ b/forgeboot-webmvc/version/.gitattributes @@ -0,0 +1,3 @@ +/gradlew text eol=lf +*.bat text eol=crlf +*.jar binary diff --git a/forgeboot-webmvc/version/.gitignore b/forgeboot-webmvc/version/.gitignore new file mode 100644 index 0000000..5a979af --- /dev/null +++ b/forgeboot-webmvc/version/.gitignore @@ -0,0 +1,40 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Kotlin ### +.kotlin diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/build.gradle.kts b/forgeboot-webmvc/version/build.gradle.kts similarity index 69% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/build.gradle.kts rename to forgeboot-webmvc/version/build.gradle.kts index 8ae3bd9..cb18ec0 100644 --- a/forgeboot-webmvc/forgeboot-webmvc-version-starter/build.gradle.kts +++ b/forgeboot-webmvc/version/build.gradle.kts @@ -1,5 +1,5 @@ dependencies { implementation(project(Modules.Core.EXTENSION)) - + kapt(libs.springBoot.configuration.processor) compileOnly(libs.springBootStarter.web) } diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/annotation/ApiVersion.kt b/forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/annotation/ApiVersion.kt similarity index 100% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/annotation/ApiVersion.kt rename to forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/annotation/ApiVersion.kt diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/VersionAutoConfiguration.kt b/forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/VersionAutoConfiguration.kt similarity index 100% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/VersionAutoConfiguration.kt rename to forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/VersionAutoConfiguration.kt diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/java/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.java b/forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.kt similarity index 52% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/java/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.java rename to forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.kt index c06fc75..1540da0 100644 --- a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/java/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.java +++ b/forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/config/entities/WebMvcVersionProperties.kt @@ -1,10 +1,11 @@ -package com.gewuyou.forgeboot.webmvc.version.config.entities; +package com.gewuyou.forgeboot.webmvc.version.config.entities -import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.ConfigurationProperties /** * 版本属性 - *

+ * + * * 该类用于配置和管理版本相关的属性,通过@ConfigurationProperties注解 * 将其与配置文件中以 version 为前缀的属性自动绑定 * @@ -12,34 +13,20 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * @since 2025-05-02 11:52:24 */ @ConfigurationProperties(prefix = "forgeboot.webmvc.version") -public class WebMvcVersionProperties { +class WebMvcVersionProperties { /** * API前缀 - *

+ * + * * 定义了API的路由前缀,用于在URL中区分不同的API版本 */ - private String apiPrefix = "/api"; + var apiPrefix: String = "/api" /** * API后缀 - *

+ * + * * 定义了API的路由后缀,用于在URL中区分不同的API版本 */ - private String apiSuffix = ""; - - public String getApiPrefix() { - return apiPrefix; - } - - public void setApiPrefix(String apiPrefix) { - this.apiPrefix = apiPrefix; - } - - public String getApiSuffix() { - return apiSuffix; - } - - public void setApiSuffix(String apiSuffix) { - this.apiSuffix = apiSuffix; - } + var apiSuffix: String = "" } diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/mapping/ApiVersionRequestMappingHandlerMapping.kt b/forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/mapping/ApiVersionRequestMappingHandlerMapping.kt similarity index 100% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/mapping/ApiVersionRequestMappingHandlerMapping.kt rename to forgeboot-webmvc/version/src/main/kotlin/com/gewuyou/forgeboot/webmvc/version/mapping/ApiVersionRequestMappingHandlerMapping.kt diff --git a/forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/forgeboot-webmvc/version/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports similarity index 100% rename from forgeboot-webmvc/forgeboot-webmvc-version-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename to forgeboot-webmvc/version/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports