Skip to content

Commit d040baa

Browse files
authored
GH-3513: Cleaning up Kotlin example in ref docs (#3541)
Fixes: #3513 #3513
1 parent 3b64536 commit d040baa

File tree

1 file changed

+7
-6
lines changed
  • spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/dynamic

1 file changed

+7
-6
lines changed

spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/dynamic/Application.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 the original author or authors.
2+
* Copyright 2022-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import org.springframework.kafka.listener.MessageListener
3333

3434
/**
3535
* @author Gary Russell
36+
* @author Soby Chacko
3637
* @since 2.8.9
3738
*/
3839
@SpringBootApplication
@@ -47,8 +48,8 @@ class Application {
4748
return ApplicationRunner { _: ApplicationArguments? ->
4849
// tag::getBeans[]
4950

50-
applicationContext.getBean(MyPojo::class.java, "one", arrayOf("topic2"))
51-
applicationContext.getBean(MyPojo::class.java, "two", arrayOf("topic3"))
51+
applicationContext.getBean(MyPojo::class.java, "one", "topic2")
52+
applicationContext.getBean(MyPojo::class.java, "two", "topic3")
5253
// end::getBeans[]
5354
}
5455
}
@@ -88,7 +89,7 @@ private fun createContainer(
8889

8990
@Bean
9091
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
91-
fun pojo(id: String?, topic: String?): MyPojo {
92+
fun pojo(id: String, topic: String): MyPojo {
9293
return MyPojo(id, topic)
9394
}
9495
//end::pojoBean[]
@@ -114,9 +115,9 @@ class MyListener : MessageListener<String?, String?> {
114115

115116
// tag::pojo[]
116117

117-
class MyPojo(id: String?, topic: String?) {
118+
class MyPojo(val id: String, val topic: String) {
118119

119-
@KafkaListener(id = "#{__listener.id}", topics = ["#{__listener.topics}"])
120+
@KafkaListener(id = "#{__listener.id}", topics = ["#{__listener.topic}"])
120121
fun listen(`in`: String?) {
121122
println(`in`)
122123
}

0 commit comments

Comments
 (0)