As far as I understand, you have two options with SpringBootTests:
- Load the whole application
- Load only what you need by specifying the classes explicitly
However, if you do 2., depending on how large the part of the application is you want to test, you'll end up with a long list of classes
@pringBootTest
@ContextConfiguration(classes = {
A.class, B.class, C.class, D.class, E.class,
F.class, G.class, H.class, I.class, J.class,
K.class, L.class, M.class, N.class, O.class,
P.class, Q.class, R.class
})
And whenever parts of what you want to test change, you have to figure out what beans are missing and manually add them to the list.
Is there any way to tell Spring if you want to test A.class to automatically detect and load the dependents automatically?
B.class, C.class, D.class, E.class, F.class, G.class, H.class, I.class, J.class, K.class, L.class, M.class, N.class, O.class, P.class