In my application, I initialize the property before running the spring application as follows:
MapLookup.setMainArguments(new String[] {"logging.profile", profile});
SpringApplication.run(source, args);
(for reference only: it is used for logging log4j2, which must be installed before spring initialization starts).
Now I want to run @IntegrationTest, but use the same logging configuration. Obviously, I cannot use the code above, since the test is JUnitnot performed using SpringApplication.run.
So how can I initialize the code before starting @RunWith(SpringJUnit4ClassRunner.class)?
Note: this BeforeClassdoes not work, as this is done after the spring context start.
source
share