I am using junit 4.11 and spring-test-4.1.5 for writing integration test cases. I am using @ContextConfiguration annotation to load the configurations.like,
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes ={ApplicationConfig.class,SpringConfiguration.class }, initializers = {CustomProfileResolver.class, AppInitializer.class}, loader = SpringApplicationContextLoader.class)
As you can see i am using two configuration classes.
The problem i am facing is i want to load the SpringConfiguration.class before ApplicationConfig.class. I tried with reversing the order but it didn't worked. Neither @order can be specified here.
So how to order the loading of these configuration classes, is it possible ?
@ContextConfigurationand its supporting classes (e.g.,MergedContextConfiguration,AnnotationConfigContextLoader,AbstractTestContextBootstrapper, etc.) are intended to retain the original ordering of@Configurationclasses declared via theclassesattribute of@ContextConfiguration.Thus, if you can verifiably prove that reversing the order of your
SpringConfigurationandApplicationConfigclasses does not result inSpringConfigurationbeing processed first, then you have found a bug in Spring.If you have found a bug, please report it in JIRA.
Thanks,
Sam