Есть тест:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { ProjectRepository.class, ProjectController.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
public class ProjectRestControllerIntegrationTest {
@Bean
ServletWebServerFactory servletWebServerFactory(){
return new TomcatServletWebServerFactory();
}
@Autowired
private MockMvc mockMvc;
@Autowired
private ProjectRepository projectRepository;
@Autowired
private ProjectController projectController;
@Test
public void contexLoads() throws Exception {
assertThat(projectRepository).isNotNull();
assertThat(projectController).isNotNull();
}
который выдает ошибку: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Как исправить?