Never mind, this was just a spring configuratin problem. The same as in this question: Testcontainers loss of connection after some tests running
I was missing the @DirtiesContesxt annotation