Spring Boot 1.4 @DataJpaTest – Error creating bean with name ‘dataSource’

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 = 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')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)