Summary:
Set up H2 as an in-memory database for the Java Spring API project to facilitate easier development and testing.
Tasks:
- Add the H2 database dependency to the
pom.xml file in the project's root directory.
- Configure the H2 database settings by editing the
src/main/resources/application-dev.properties and src/main/resources/application-test.properties files. Add the following properties:
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
- Make sure the H2 console is enabled and accessible at
/h2-console for dev and test profiles.
- Update the
DEV_README.md with a new section titled "Development Database" that explains how to use the H2 database and access the console.
Acceptance Criteria:
- The application starts with H2 in-memory database for dev and test profiles.
- The H2 console is accessible via browser at
/h2-console.
- Instructions for usage are clear in the documentation.
Summary:
Set up H2 as an in-memory database for the Java Spring API project to facilitate easier development and testing.
Tasks:
pom.xmlfile in the project's root directory.src/main/resources/application-dev.propertiesandsrc/main/resources/application-test.propertiesfiles. Add the following properties:/h2-consolefor dev and test profiles.DEV_README.mdwith a new section titled "Development Database" that explains how to use the H2 database and access the console.Acceptance Criteria:
/h2-console.