Seems like a @SpringBootTest cannot be used to test a @KafkaListener when using a container factory on it and also using Testcontainers for the underlying infrastructure.

I created a very small replica project in which the issue reproduces, which can be found here. Did anyone experience the same thing?

The corresponding stack overflow issue can be found here: https://stackoverflow.com/questions/78590700/kafkalistener-with-containerfactory-is-not-triggered-in-springboottest

Comment From: wilkinsona

Please don't cross-post to both Stack Overflow and an issue tracker. It just duplicates effort and wastes people's time. Given that you're configuring Kafka yourself rather than using Spring Boot's auto-configuration and also managing the Kafka Testcontainer yourself, this doesn't look like a Spring Boot problem to me. Hopefully one of the people already trying to help you on Stack Overflow will be able to suggest something.

/cc @artembilan who's the lead of the Spring Kafka project and may want to take a look at the SO question if he hasn't already seen it.

Comment From: AvramPop

@wilkinsona thanks for taking the time to respond. My hunch is that this is a Spring Boot test issue exactly because the different components cannot get wired together. Thanks for cc-ing Artem, hope we will find a solution. If the SO thread does not yield a response, I'm afraid this is something that would be better discussed here.

Comment From: AvramPop

The issue has been cleared up. See the above SO thread.