Starting with Spring 3.1 applications can specify contextInitializerClasses via context-param and init-param in web.xml.
For comprehensive testing it should be possible to re-use ApplicationContextInitializer instances in tests as well.
This could be done at the @ContextConfiguration level by allowing an array of ACI types to be specified, and the TCF would allow each to visit the ApplicationContext at the right time.
- Introduce a new initializers attribute in @ContextConfiguration.
- Introduce a new inheritInitializers attribute in @ContextConfiguration.
- Allow a context to be loaded solely via a custom ApplicationContextInitializer (i.e., without locations or classes)
- Initializers must be included in MergedContextConfiguration for determining the context cache key.
- Invoke initializers within existing SmartContextLoader implementations.
- for example, in AbstractGenericContextLoader.loadContext(...) methods
- per the contract defined in the Javadoc for ApplicationContextInitializer: ApplicationContextInitializer processors are encouraged to detect whether Spring's Ordered interface has been implemented or if the @Order annotation is present and to sort instances accordingly if so prior to invocation.
- Document in Javadoc
- Document in the reference manual