in Education by
I configure 10 kafka topics in my yaml file and I need create all topics on aplication start. But I do not understand how can I do it with List. I can Create one bean: @Bean public NewTopic newTopic() { return new NewTopic("topic-name", 5, (short) 1); } But now I have list configs: @PostConstruct public void init(){ Map topics = this.topics.getTopics(); for (Map.Entry topicEntry : topics.entrySet()) { TopicProperties.Topic topic = topicEntry.getValue(); String topicName = topic.getTopicName(); int partitions = topic.getNumPartitions(); short replicationFactor = topic.getReplicationFactor(); //how can I create new bean of NewTopic? } } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You need to implement ContextCustomizer Get a reference of ConfigurableListableBeanFactory and manually call ConfigurableListableBeanFactory.initializeBean() and ConfigurableListableBeanFactory.registerSingleton() I do not think there is any easy way via classic spring annotations.. You can get a starting point from Context hierarchy in Spring Boot based tests

Related questions

0 votes
    I configure 10 kafka topics in my yaml file and I need create all topics on aplication start. But ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I configure 10 kafka topics in my yaml file and I need create all topics on aplication start. But ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    For which of the following criteria can Spring boot auto configuration be done? A. Presence of a System Property B. ... of a particular class in classpath E. All the options...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    Spring boot follows Opinionated Defaults Configuration approach to reduce developer effort. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    Which is the way to provide configuration metadata to Spring? A. Java-based configuration B. Annotation-based configuration C. XML-based configuration file D. All the options...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    Specific Auto-Configuration classes cannot be disabled in Spring. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    How to create a non-web application in Spring Boot?...
asked Jul 7, 2021 in Technology by JackTerrance
0 votes
    I know how to use the checkboxlist in ASP.NET to display options retrieved from a database. What I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    Is Dependency needed to create a Spring Boot web application? 1. Spring-boot-starter-web 2. Spring-boot-starter-test 3. Spring-boot-html 4. None of the Above...
asked Jul 8, 2021 in Education by JackTerrance
0 votes
    I got an openshift cluster with 2 nodes (a master and a slave), I want to change the config file ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I have to Update the Xml document object generated using Apache XMLbeans.There are two ways I am trying to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    Which of the following is not an Enterprise Beans type? (a) Doubleton (b) Singleton (c) Stateful (d) Stateless ... & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Which of the following is not true about Java beans? (a) Implements java.io.Serializable interface (b) Extends java. ... & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Java Beans are extremely secured? (a) True (b) False I got this question in unit test. Question is taken from ... Beans & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Which of the following is not a feature of Beans? (a) Introspection (b) Events (c) Persistence (d) Serialization ... & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
...