Micronaut Gorm Demo

Experiments to get Gorm working in tests with Testcontainers

Running the application

./gradlew run

Shows 3 users

Testing the application

./gradlew test

The test is using Testcontainers, where part of the configuration is in the test itself (jdbc url etc.) and part is in the application-test.yml file.

Solution Branch - Don’t do it like that

On the solution branch, there is a solution, but it seems clumsy. Creating a class which implements ApplicationEventListener<ServerStartupEvent> that creates a HibernateDatastore if the environment is TEST.

Credits