As @Sean Patrick Floyd points out, the need for ApplicationContext is often due to poor design. But sometimes you have no other choice. In such cases, I prefer to use @Autowired because I enter all the other properties. So, if I use @Autowired to inject MyRepository, why can't I use it for ApplicationContext or any other Spring bean?
I only use Spring interfaces for those things that I cannot do with annotations, like BeanNameAware.
source share