Reputation: 287530
Is there a way to have the test profile be automatically activated for all tests in Spring Boot? I don't want to depend on class annotations or command line arguments as both are error-prone.
Upvotes: 9
Views: 4016
Reputation: 10185
Yes, you can create application properties files in test/resources directory.
Just create /src/test/resources/application.properties
or /src/test/resources/application.yml
file contains
spring.profiles.active=test
This application.*
file wil be used only in testing.
Upvotes: 9