mardi 29 décembre 2015

Spring boot test profiling

I have for example 3 developers : DEV1, DEV2 and DEV3. I want every one has their own application-DEV1(2)(3)-properties in /test/resources/ folder.

I have an class

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyApplication.class) 

I don't want to use @ActiveProfiles annotation on class because than every time you want to run tests every user has to added value to load their own configurations. I am using IntelliJ so I set Maven run configuration with command

clean test

and profile DEV1 eg.

When I run test result is next: On the start up of test running output I can see:

/usr/lib/jvm/java-8-oracle/bin/java -Dspring.profiles.active=DEV1

But it comes to concrete test class output is :

2015-12-29 12:52:10.129  INFO 17211 --- [           main] MyClassTest  : Starting MyClassTest on dev with PID 17211 
2015-12-29 12:52:10.130  INFO 17211 --- [           main] MyClassTest  : No profiles are active

What I am missing here?

Aucun commentaire:

Enregistrer un commentaire