The slow autowire by type problem has finally been solved by creating a caching bean factory.
I would really like to be able to use such a CachingByTypeBeanFactory together with SpringJUnit4ClassRunner for running JUnit tests with @Autowired. But it does not seem to be possible to change the Bean Factory on the application context via the ContextLoader.
Is there any other way to do this ?
Create your own ContextLoader and attach this annotation to your JUnit class:
This is my example Loader which instantiates another or custom ApplicationContext which in turn may be initialized with custom BeanFactory (depending of capabilities):
}
In above case application context (provided by Spring Framework) has constructor: