How to access a resource file in src/main/resources/ folder in Spring Boot

In this blog post we will see different ways to access resource file in src/main/resources folder in Spring Boot. 1) Using ResourceLoader 2) Using Resource 3) Using ClassPathResource 4) Using ClassLoader Note : In above code example, the path should always start with “/” 5) Using ContextClassLoader Sourcecode for blog post can be downloaded from…

Integration Testing in Spring Boot Application with Wiremock and Testcontainers

In this blog post we will see how to use Wiremock for Spring Boot integration testing using Testcontainers. In one of my previous blog post, I have shown you how to mock external API using Wiremock library.In that blog post we have used annotation and programmatic approach to start the Wiremock server. Wiremock server also…

Mock HTTP API for Testing with Wiremock

Wiremock is an open-source tool used for mocking API responses. It helps developers to write reliable and efficient tests for their APIs by mimicking the behavior of external services and improve the overall quality of software.It allows them to simulate various scenarios and responses without having to set up complicated infrastructure or rely on external…