Show pageBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Using H2 As DataSource For Testing ====== - In build.gradle, add ''runtimeOnly 'com.h2database:h2'' in dependencies section - Open application.properties - Add lines<code>spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.h2.console.enabled=true</code> Note that we set console.enable to true so that we can access H2 by web browser - To access the H2 database, go to http://localhost:8080/h2-console/ for default setting For maven: <code> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> </code> springboot/using_h2_as_datasource_for_testing.txt Last modified: 2020/12/11 17:20by chongtin