mirror of
https://github.moeyy.xyz/https://github.com/GeWuYou/forgeboot
synced 2025-10-28 03:02:07 +08:00
refactor(forgeboot-webmvc): Removing the unused WebMvcConfigurer import in VersionAutoConfiguration removes the unused WebMvcConfigurer import statement from the VersionAutoConfiguration.kt file, simplifying the structure of the code and improving the readability of the code.
This commit is contained in:
parent
051c0e44da
commit
da3bd2f714
@ -3,6 +3,7 @@ package com.gewuyou.forgeboot.webmvc.version.config
|
|||||||
import com.gewuyou.forgeboot.core.extension.log
|
import com.gewuyou.forgeboot.core.extension.log
|
||||||
import com.gewuyou.forgeboot.webmvc.version.config.entities.VersionProperties
|
import com.gewuyou.forgeboot.webmvc.version.config.entities.VersionProperties
|
||||||
import com.gewuyou.forgeboot.webmvc.version.mapping.ApiVersionRequestMappingHandlerMapping
|
import com.gewuyou.forgeboot.webmvc.version.mapping.ApiVersionRequestMappingHandlerMapping
|
||||||
|
import jakarta.annotation.PostConstruct
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties
|
import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
@ -20,6 +21,7 @@ open class VersionAutoConfiguration(
|
|||||||
private val versionProperties: VersionProperties,
|
private val versionProperties: VersionProperties,
|
||||||
private val corsConfigurationSource: CorsConfigurationSource
|
private val corsConfigurationSource: CorsConfigurationSource
|
||||||
) {
|
) {
|
||||||
|
private lateinit var mapping: ApiVersionRequestMappingHandlerMapping
|
||||||
/**
|
/**
|
||||||
* 创建并配置一个 ApiVersionRequestMappingHandlerMapping 实例
|
* 创建并配置一个 ApiVersionRequestMappingHandlerMapping 实例
|
||||||
*
|
*
|
||||||
@ -34,7 +36,10 @@ open class VersionAutoConfiguration(
|
|||||||
log.info("创建 API 版本请求映射处理程序映射")
|
log.info("创建 API 版本请求映射处理程序映射")
|
||||||
return ApiVersionRequestMappingHandlerMapping(versionProperties).also {
|
return ApiVersionRequestMappingHandlerMapping(versionProperties).also {
|
||||||
it.order = Int.MIN_VALUE
|
it.order = Int.MIN_VALUE
|
||||||
it.corsConfigurationSource = corsConfigurationSource
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@PostConstruct
|
||||||
|
fun injectCors() {
|
||||||
|
mapping.corsConfigurationSource = corsConfigurationSource
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user