You do not need to use any test contexts (doesn't matter is XML or Java based). Since Spring boot 1.4 there is available new annotation @MockBean
which introduced native support for mocking and Spying of Spring Beans.
↧
Answer by luboskrnac for Spring beans redefinition in unit test environment
↧