I have a code similar to the follows:
@RunWith(SpringRunner.class)
@SpringBootTest
public class ModelRunnerTest {
@Autowired
private SomeRepository repository;
@Autowired
private SomeSearcher someSearcher;
@Test
public void test(){
someSearcher.search(repository);
}
}
It works - but also create all beans in the same context as the 2 created beans. This can take a long time (and I run this test every build/deploy).
So, I would like to find a way for the test to load only the necessary beans for the test. In this example it will be only repository & someSearcher.
I know I can provide an alternative implementation for beans using @BeanMock, but the actual implementations for the beans will still be created (although not used).
Any suggestions?