I\'ve created a new spring boot 1.4 application, want to try some testing using @DataJpaTest but keep getting the following error message
Caused by: org.springframew
We don't provide an embedded database by default. By default DataJpaTest
replaces your DataSource
with an embedded database but you don't have one.
So, if you want to test with MySQL, replace your test as follows:
@RunWith(SpringRunner.class)
@DataJpaTest
@AutoConfigureTestDatabase(replace = NONE)
final public class MyRepositoryTest {
}
If you want to use an in-memory database for those tests, you need to add one to the test classpath. Add this to your gradle file
testCompile('com.h2database:h2')