Peter Kronenberg
Peter Kronenberg

Reputation: 1306

How to specify Spring boot profile when running tests in IntelliJ

With IntelliJ, I can specify a Spring boot profile to run when starting a service enter image description here

However, if I run mvn clean install, then the tests are run with the default profile, which causes them to fail. How can I tell mvn to run the tests with a specific Spring Boot profile?

Upvotes: 0

Views: 1639

Answers (1)

Harsh
Harsh

Reputation: 972

Create/define a properties file and put it within your src/test/resources folder.

Use class level annotation @ActiveProfiles and specify your property file name like this @ActiveProfiles("myProperties")

Hope this helps!

Upvotes: 2

Related Questions