Skip to content

Commit e2f0033

Browse files
committed
升级Spring Cloud 2024.0.0
1 parent 1f2b5ea commit e2f0033

23 files changed

Lines changed: 78 additions & 58 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
| 依赖 | 版本 |
5151
| ------------ |----------|
5252
| JDK | 17 |
53-
| Kotlin | 1.8.22 |
54-
| Gradle | 7.6.3 |
55-
| Spring Boot | 3.0.11 |
56-
| Spring Cloud | 2022.0.4 |
53+
| Kotlin | 2.0.21 |
54+
| Gradle | 8.10.2 |
55+
| Spring Boot | 3.4.0 |
56+
| Spring Cloud | 2024.0.0 |
5757

5858
## 示例
5959

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
id("com.tencent.devops.publish") version Versions.DevopsReleasePlugin
1212
}
1313

14-
val projectVersion = rootProject.file("version.txt").readText()
14+
val projectVersion = rootProject.file("version.txt").readText().trim()
1515

1616
allprojects {
1717
group = "com.tencent.devops"

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object Libs {
55
const val SpringBootGradlePlugin = "org.springframework.boot:spring-boot-gradle-plugin:${Versions.SpringBoot}"
66
const val DependencyManagement = "io.spring.gradle:dependency-management-plugin:${Versions.DependencyManagement}"
77
const val KotlinSpringGradlePlugin = "org.jetbrains.kotlin:kotlin-allopen:${Versions.Kotlin}"
8-
const val KtLint = "com.pinterest:ktlint:${Versions.KtLint}"
8+
const val KtLint = "com.pinterest.ktlint:ktlint-cli:${Versions.KtLint}"
99
const val GoogleJibPlugin = "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${Versions.Jib}"
1010
const val GradleNexuxPublishPlugin = "io.github.gradle-nexus:publish-plugin:${Versions.GradleNexusPublish}"
1111
}
@@ -15,4 +15,3 @@ object MavenBom {
1515
const val SpringCloud = "org.springframework.cloud:spring-cloud-dependencies:${Versions.SpringCloud}"
1616
const val DevOpsBoot = ":devops-boot-project:devops-boot-dependencies"
1717
}
18-
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
object Versions {
22
const val Jib: String = "3.2.0"
33
const val Java = "17"
4-
const val Kotlin = "1.8.22"
5-
const val SpringBoot = "3.3.2"
6-
const val SpringCloud = "2023.0.3"
4+
const val Kotlin = "2.0.21"
5+
const val SpringBoot = "3.4.0"
6+
const val SpringCloud = "2024.0.0"
77
const val DependencyManagement = "1.1.6"
88
const val GradleNexusPublish = "1.3.0"
9-
const val KtLint = "0.50.0"
9+
const val KtLint = "1.3.1"
1010
const val DevopsReleasePlugin = "0.0.9"
1111
}

buildSrc/src/main/kotlin/ktlint.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies {
88
}
99
}
1010

11-
val outputDir = "${project.buildDir}/reports/ktlint/"
11+
val outputDir = "${project.layout.buildDirectory}/reports/ktlint/"
1212
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
1313

1414
val ktlintCheck by tasks.creating(JavaExec::class) {
@@ -18,7 +18,7 @@ val ktlintCheck by tasks.creating(JavaExec::class) {
1818

1919
description = "Check Kotlin code style."
2020
classpath = ktlint
21-
main = "com.pinterest.ktlint.Main"
21+
mainClass.set("com.pinterest.ktlint.Main")
2222
args = listOf("src/**/*.kt")
2323
}
2424

@@ -29,6 +29,6 @@ val ktlintFormat by tasks.creating(JavaExec::class) {
2929

3030
description = "Fix Kotlin code style deviations."
3131
classpath = ktlint
32-
main = "com.pinterest.ktlint.Main"
32+
mainClass.set("com.pinterest.ktlint.Main")
3333
args = listOf("-F", "src/**/*.kt")
3434
}

devops-boot-project/devops-boot-core/build.gradle.kts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
kotlin("jvm")
35
kotlin("kapt")
@@ -36,17 +38,24 @@ subprojects {
3638
targetCompatibility = Versions.Java
3739
}
3840
compileKotlin {
39-
kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-java-parameters")
40-
kotlinOptions.jvmTarget = Versions.Java
41+
compilerOptions {
42+
freeCompilerArgs.add("-Xjsr305=strict")
43+
freeCompilerArgs.add("-java-parameters")
44+
jvmTarget.set(JvmTarget.fromTarget(Versions.Java))
45+
}
4146
}
4247
compileTestKotlin {
43-
kotlinOptions.jvmTarget = Versions.Java
48+
compilerOptions {
49+
jvmTarget.set(JvmTarget.fromTarget(Versions.Java))
50+
}
4451
}
4552
test {
4653
useJUnitPlatform()
4754
}
4855
withType(org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask::class.java).configureEach {
49-
kotlinOptions.jvmTarget = Versions.Java
56+
compilerOptions {
57+
jvmTarget.set(JvmTarget.fromTarget(Versions.Java))
58+
}
5059
}
5160
}
5261
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
com.tencent.devops.logging.LoggingAutoConfiguration
1+
com.tencent.devops.logging.LoggingAutoConfiguration

devops-boot-project/devops-boot-core/devops-plugin/devops-plugin-core/src/main/kotlin/com/tencent/devops/plugin/spring/SpringExtensionRegistry.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class SpringExtensionRegistry : ExtensionRegistry, ApplicationContextAware {
3030
require(WebApplicationContext::class.java.isAssignableFrom(applicationContext::class.java))
3131
this.applicationContext = applicationContext
3232
this.beanFactory = applicationContext.autowireCapableBeanFactory as DefaultListableBeanFactory
33-
this.requestMappingHandlerMapping = applicationContext.getBean(RequestMappingHandlerMapping::class.java)
33+
this.requestMappingHandlerMapping = applicationContext.getBean(
34+
"requestMappingHandlerMapping",
35+
RequestMappingHandlerMapping::class.java
36+
)
3437
}
3538

3639
override fun registerExtensionController(plugin: String, name: String, type: Class<*>) {

devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/convert/PulsarMessageConverter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PulsarMessageConverter {
7171
ClassUtils.forName(
7272
"com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter",
7373
ClassUtils.getDefaultClassLoader()
74-
).newInstance() as MessageConverter
74+
).getDeclaredConstructor().newInstance() as MessageConverter
7575
)
7676
} catch (ignored: ClassNotFoundException) {
7777
// ignore this exception

devops-boot-project/devops-boot-core/devops-pulsar/src/main/kotlin/com/tencent/devops/stream/binder/pulsar/integration/inbound/PulsarInboundChannelAdapter.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class PulsarInboundChannelAdapter(
8888
concurrency = extendedConsumerProperties.concurrency
8989
)
9090
} catch (e: Exception) {
91-
logger.error("DefaultPulsarConsumer init failed, Caused by " + e.message)
91+
log.error("DefaultPulsarConsumer init failed, Caused by " + e.message)
9292
throw MessagingException(
9393
MessageBuilder.withPayload(
9494
"DefaultPulsarConsumer init failed, Caused by " + e.message
@@ -132,16 +132,16 @@ class PulsarInboundChannelAdapter(
132132
private fun createListener(): (Consumer<*>, Message<*>) -> Unit {
133133
return { it: Consumer<*>, msg: Message<*> ->
134134
try {
135-
if (logger.isDebugEnabled) {
136-
logger.debug("Message received $msg ${msg.messageId}")
135+
if (log.isDebugEnabled) {
136+
log.debug("Message received $msg ${msg.messageId}")
137137
}
138138
val message = PulsarMessageConverterSupport.convertMessage2Spring(msg)
139139
if (retryTemplate != null) {
140140
retryTemplate!!.execute(
141141
RetryCallback<Any, RuntimeException> { _: RetryContext? ->
142142
sendMessage(message)
143-
if (logger.isDebugEnabled) {
144-
logger.debug("will send acknowledge: ${msg.messageId}")
143+
if (log.isDebugEnabled) {
144+
log.debug("will send acknowledge: ${msg.messageId}")
145145
}
146146
it.acknowledge(msg)
147147
message
@@ -150,16 +150,16 @@ class PulsarInboundChannelAdapter(
150150
)
151151
} else {
152152
sendMessage(message)
153-
if (logger.isDebugEnabled) {
154-
logger.debug("will send acknowledge: ${msg.messageId}")
153+
if (log.isDebugEnabled) {
154+
log.debug("will send acknowledge: ${msg.messageId}")
155155
}
156156
it.acknowledge(msg)
157157
}
158-
if (logger.isDebugEnabled) {
159-
logger.debug("Message ${msg.messageId} has been consumed")
158+
if (log.isDebugEnabled) {
159+
log.debug("Message ${msg.messageId} has been consumed")
160160
}
161161
} catch (e: Exception) {
162-
logger.warn("Error occurred while consuming message ${msg.messageId}: $e")
162+
log.warn("Error occurred while consuming message ${msg.messageId}: $e")
163163
it.negativeAcknowledge(msg)
164164
}
165165
}
@@ -187,15 +187,15 @@ class PulsarInboundChannelAdapter(
187187
consumers.add(consumer)
188188
}
189189
} catch (e: Exception) {
190-
logger.error("Error occurred while creating consumer $e")
190+
log.error("Error occurred while creating consumer $e")
191191
}
192192

193193
// val instrumentation = Instrumentation(topic, this)
194194
// try {
195195
// instrumentation.markStartedSuccessfully()
196196
// } catch (e: java.lang.Exception) {
197197
// instrumentation.markStartFailed(e)
198-
// logger.error("PulsarConsumer init failed, Caused by " + e.message)
198+
// log.error("PulsarConsumer init failed, Caused by " + e.message)
199199
// throw MessagingException(
200200
// MessageBuilder.withPayload(
201201
// "PulsarConsumer init failed, Caused by " + e.message
@@ -228,6 +228,8 @@ class PulsarInboundChannelAdapter(
228228
}
229229

230230
companion object {
231-
private val logger = LoggerFactory.getLogger(PulsarInboundChannelAdapter::class.java)
231+
// 命名为logger会和IntegrationObjectSupport中的logger冲突
232+
// https://youtrack.jetbrains.com/issue/KT-56386
233+
private val log = LoggerFactory.getLogger(PulsarInboundChannelAdapter::class.java)
232234
}
233235
}

0 commit comments

Comments
 (0)