Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example in the documentation for Dynamically Creating Containers - Prototype Beans (Kotlin) is wrong #3513

Open
mohamedmelfiky opened this issue Sep 22, 2024 · 1 comment
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: bug type: documentation
Milestone

Comments

@mohamedmelfiky
Copy link

mohamedmelfiky commented Sep 22, 2024

Spring Kafka 3.2.4

In the documentation for Dynamically Creating Containers - Prototype Beans (Kotlin) the example throw exception.
It should be as follow instead

  class MyPojo(val id: String, val topic: String) {

      @KafkaListener(id = "#{__listener.id}", topics = ["#{__listener.topic}"])
      fun listen(`in`: String?) {
          println(`in`)
      }
  
  }
  
  @Bean
  @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
  fun pojo(id: String, topic: String): MyPojo {
      return MyPojo(id, topic)
  }
  
  applicationContext.getBean(MyPojo::class.java, "one", "topic2")
  applicationContext.getBean(MyPojo::class.java, "two", "topic3")

Link to the above mentioned documentation paragraph:

https://docs.spring.io/spring-kafka/reference/kafka/dynamic-containers.html#prototype-beans

@artembilan artembilan added this to the 3.3.0-RC1 milestone Sep 23, 2024
@artembilan artembilan added type: documentation ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. and removed status: waiting-for-triage labels Sep 23, 2024
@artembilan
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: bug type: documentation
Projects
None yet
Development

No branches or pull requests

2 participants