I have my configuration in the application.yml file in the classpath root folder (src / main / resources /). The configuration loads normally when I run the application normally. However, in my test, the application.yml file does not load at all.
The title of my test is as follows:
@RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = Configuration.class) @org.junit.Ignore public class ApplicationIntegrationTest { @Inject private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } ...
Configuration class:
@EnableAutoConfiguration @ComponentScan("cetsweb, cetsservice") public class Configuration extends WebMvcConfigurerAdapter {
When I debug the application, I see that the yml files are loaded in the ConfigFileApplicationListener, however in the test, however, the ConfigFileApplicationListener is not called.
source share