mirror of
https://github.moeyy.xyz/https://github.com/GeWuYou/forgeboot
synced 2025-10-27 13:14:23 +08:00
Compare commits
8 Commits
9cdc962d9a
...
0ca32efc02
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ca32efc02 | |||
| b1811f5941 | |||
| ae09ddbd8a | |||
| f13b21e640 | |||
| da3bd2f714 | |||
| 051c0e44da | |||
| b2ce2c46dd | |||
| 0920a83e1c |
@ -105,7 +105,7 @@ subprojects {
|
||||
}
|
||||
}
|
||||
// Gitea 仓库
|
||||
val host = System.getenv("GEWUYOU_GITEA_HOST")
|
||||
val host = System.getenv("GITEA_HOST")
|
||||
host?.let {
|
||||
maven {
|
||||
isAllowInsecureProtocol = true
|
||||
@ -113,7 +113,7 @@ subprojects {
|
||||
url = uri("http://${it}/api/packages/gewuyou/maven")
|
||||
credentials(HttpHeaderCredentials::class.java) {
|
||||
name = "Authorization"
|
||||
value = "token ${System.getenv("GEWUYOU_GITEA_TOKEN")}"
|
||||
value = "token ${System.getenv("GITEA_TOKEN")}"
|
||||
}
|
||||
authentication {
|
||||
create("header", HttpHeaderAuthentication::class.java)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// This file is used to define the repositories used by the project.
|
||||
repositories {
|
||||
mavenLocal()
|
||||
val host = System.getenv("GEWUYOU_GITEA_HOST")
|
||||
val host = System.getenv("GITEA_HOST")
|
||||
host?.let {
|
||||
maven{
|
||||
url = uri("http://${host}/api/packages/gewuyou/maven")
|
||||
|
||||
@ -18,7 +18,7 @@ data class R<T>(
|
||||
val message: String,
|
||||
val data: T? = null,
|
||||
val requestId: String? = null,
|
||||
val extra: Map<String, Any?> = emptyMap() // ✅ 扩展字段保存位置
|
||||
val extra: Map<String, Any?> = emptyMap()
|
||||
) {
|
||||
/**
|
||||
* 转换为可变 Map,包含 extra 中的字段
|
||||
@ -33,7 +33,7 @@ data class R<T>(
|
||||
if (!requestId.isNullOrBlank()) {
|
||||
map["requestId"] = requestId
|
||||
}
|
||||
map.putAll(extra) // ✅ 扁平化合并
|
||||
map.putAll(extra)
|
||||
return map
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author gewuyou
|
||||
* @since 2025-05-02 11:52:24
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "version")
|
||||
@ConfigurationProperties(prefix = "forgeboot.version")
|
||||
public class VersionProperties {
|
||||
/**
|
||||
* API前缀
|
||||
|
||||
@ -6,6 +6,8 @@ import com.gewuyou.forgeboot.webmvc.version.mapping.ApiVersionRequestMappingHand
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.web.cors.CorsConfigurationSource
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
|
||||
|
||||
/**
|
||||
*版本自动配置
|
||||
@ -26,8 +28,14 @@ open class VersionAutoConfiguration {
|
||||
* @return ApiVersionRequestMappingHandlerMapping 实例,用于处理基于 API 版本的请求映射
|
||||
*/
|
||||
@Bean
|
||||
open fun apiVersionRequestMappingHandlerMapping(versionProperties: VersionProperties): ApiVersionRequestMappingHandlerMapping {
|
||||
open fun apiVersionRequestMappingHandlerMapping(
|
||||
versionProperties: VersionProperties,
|
||||
corsConfigurationSource: CorsConfigurationSource,
|
||||
): RequestMappingHandlerMapping {
|
||||
log.info("创建 API 版本请求映射处理程序映射")
|
||||
return ApiVersionRequestMappingHandlerMapping(versionProperties).also { it.order = Int.MIN_VALUE }
|
||||
return ApiVersionRequestMappingHandlerMapping(versionProperties).also {
|
||||
it.order = Int.MIN_VALUE
|
||||
it.corsConfigurationSource = corsConfigurationSource
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user