Override Properties in Spring’s Tests
¶1. Overview
In this tutorial, we’ll have a look at various ways to override properties in Spring’s tests.
Spring actually provides a number of solutions for this, so we have quite a bit to explore here.
¶2. Dependencies
Of course, in order to work with Spring tests, we need to add a test dependency:<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.5.1</version>
<scope>test</scope>
</dependency>
This dependency also includes Junit 5 for us.