@@ -94,8 +94,7 @@ public void start() {
9494 // TODO: JWT auto configuration
9595// autoConfigureJwt();
9696 autoConfigureDatabases ();
97- // TODO: Kafka auto configuration (fix classpath conflicts)
98- // autoConfigureKafka();
97+ autoConfigureKafka ();
9998 autoConfigureMongoDB ();
10099 }
101100
@@ -150,7 +149,9 @@ private void autoConfigureDatabases() {
150149 }
151150
152151 private void autoConfigureKafka () {
153- if (System .getProperty ("quarkus.kafka.bootstrap-servers" ) != null )
152+ final String KAFKA_PROP = "kafka.bootstrap.servers" ;
153+ //kafka.bootstrap.servers
154+ if (System .getProperty (KAFKA_PROP ) != null )
154155 return ; // Do not override explicit configuration
155156 try {
156157 Class <?> KafkaContainerClass = Class .forName ("org.testcontainers.containers.KafkaContainer" );
@@ -160,12 +161,12 @@ private void autoConfigureKafka() {
160161 if (kafkaContainers .size () == 1 ) {
161162 GenericContainer <?> kafka = kafkaContainers .get (0 );
162163 String bootstrapServers = (String ) KafkaContainerClass .getMethod ("getBootstrapServers" ).invoke (kafka );
163- System .setProperty ("quarkus.kafka.bootstrap-servers" , bootstrapServers );
164+ System .setProperty (KAFKA_PROP , bootstrapServers );
164165 if (LOG .isInfoEnabled ())
165- LOG .info ("Set quarkus.kafka.bootstrap-servers =" + bootstrapServers );
166+ LOG .info ("Set " + KAFKA_PROP + " =" + bootstrapServers );
166167 } else if (kafkaContainers .size () > 1 ) {
167168 if (LOG .isInfoEnabled ())
168- LOG .info ("Located multiple KafkaContainer instances. Unable to auto configure 'quarkus.kafka.bootstrap-servers ' property" );
169+ LOG .info ("Located multiple KafkaContainer instances. Unable to auto configure '" + KAFKA_PROP + " ' property" );
169170 } else {
170171 if (LOG .isDebugEnabled ())
171172 LOG .debug ("No KafkaContainer instances found in configuration" );
0 commit comments