Adding configuration class to SpringBootTest breaks component scan
问题 I am trying to disable real Mongo connection and replace it with Fongo mock in tests. Here is my test class: @SpringBootTest @RunWith(SpringRunner.class) public class ControllerTest { @Autowired private WebApplicationContext wac; @Autowired private ObjectMapper objectMapper; @MockBean private MyService service; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test public void performTest() throws Exception { ...