1
1
/*
2
- * Copyright 2022-2023 the original author or authors.
2
+ * Copyright 2022-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import org.springframework.kafka.listener.MessageListener
33
33
34
34
/* *
35
35
* @author Gary Russell
36
+ * @author Soby Chacko
36
37
* @since 2.8.9
37
38
*/
38
39
@SpringBootApplication
@@ -47,8 +48,8 @@ class Application {
47
48
return ApplicationRunner { _: ApplicationArguments ? ->
48
49
// tag::getBeans[]
49
50
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" )
52
53
// end::getBeans[]
53
54
}
54
55
}
@@ -88,7 +89,7 @@ private fun createContainer(
88
89
89
90
@Bean
90
91
@Scope(ConfigurableBeanFactory .SCOPE_PROTOTYPE )
91
- fun pojo (id : String? , topic : String? ): MyPojo {
92
+ fun pojo (id : String , topic : String ): MyPojo {
92
93
return MyPojo (id, topic)
93
94
}
94
95
// end::pojoBean[]
@@ -114,9 +115,9 @@ class MyListener : MessageListener<String?, String?> {
114
115
115
116
// tag::pojo[]
116
117
117
- class MyPojo (id : String? , topic : String? ) {
118
+ class MyPojo (val id : String , val topic : String ) {
118
119
119
- @KafkaListener(id = " #{__listener.id}" , topics = [" #{__listener.topics }" ])
120
+ @KafkaListener(id = " #{__listener.id}" , topics = [" #{__listener.topic }" ])
120
121
fun listen (`in `: String? ) {
121
122
println (`in `)
122
123
}
0 commit comments