I\'m fairly new to Spring, trying to do some basic integration tests for a @Controller
.
@RunWith(SpringRunner.class)
@WebMvcTest(DemoController.clas
Add @MockBean(JpaMetamodelMappingContext.class)
to above of class DemoControllerIntegrationTests
:
@RunWith(SpringRunner.class)
@WebMvcTest(DemoController.class)
@MockBean(JpaMetamodelMappingContext.class)
public class DemoControllerIntegrationTests {
...
}
Because you have not used a database in your test, Spring throws this exception. By mocking JpaMetamodelMappingContext
class you will bypass the needed metamodel.