Skip to Content
Former Member
Oct 11, 2016 at 04:37 PM

Spring active profile ambiguity



I'm having trouble with setting some bean to be active only when spring profile is set to production.

Basically, what happens is that when I run my integration tests,it looks like my production profile is also active, and it shouldn't be.

Relevant part of

myextension's relevant part of

Now the things get interesting. Here is the part of my test class:

 private Environment environment;
 private ConfigurationService configurationService;
 public void dummyTest() {
   String first = (String ) configurationService.getConfiguration().getProperty("");
   String[] second = environment.getActiveProfiles();

When I run this test, variable "first" has value "myextension_test", and variable "second" has value ["myextension_test", "myextension_prod", "tenant_junit"]. How come that these 2 variables differ? I was expecting only myextension_test profiile to be active. OK, I understand tenant_junit also, but why did Hybris also activated myextension_prod profile ? Looks like merged with, instead of overriding it.

I ran my tests with "ant integrationtests" command.

Did anybody have similar problems?

Thanks in advance, Antun