'Run IntegrationTest with Spring Boot and Docker
I have MongoDB Database, ActiveMQ, Docker and a Spring Boot Project. The docker files are already defined and docker-compose works well. It starts the database, message broker and the webserver for the API-Endpoints.
I wrote an integration test in Spring Boot with Rest Assured against the Webserver from Docker, which works also. First I execute docker-compose up -d and then the integration tests.
But If I want to access the repository and autowire it to check if a POST saved the data in the database, this error appears: failed to load the application context. Altough I wrote @RunWith(SpringRunner.class), @SpringBootTest and @ContextConfiguration.
Also I overwrite the application.properties from Spring with @DynamicPropertySource. With that I add the jdbc connection to the MongoDB Server from Docker
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
