I have a Spring 4 JUnit test which should verify only a particular part of my application.
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:context-test.xml")
@ActiveProfiles("test")
public class FooControllerIntegrationTest {
...
}
So I don't want to configure and instantiate all those beans which are actually aren't involved into the scope of my test. For example I don't want to configure beans which are used in another controller which I am not going to test here.
However, because I don't want to narrow component-scan pathes, I get "No qualifying bean of type" exception:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [...
Is any way how to ignore such missed definitions if I certainly sure that they aren't involved into the functionality I am testing?