Skip to content

Commit

Permalink
switch to in memory db
Browse files Browse the repository at this point in the history
  • Loading branch information
thesarfo committed Nov 5, 2024
1 parent cec5132 commit 4be4197
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY target/lab-crud-0.0.1-SNAPSHOT.jar lab-crud.jar
EXPOSE 8080
CMD ["java", "-jar", "lab-crud.jar"]
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
Expand Down
7 changes: 3 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
spring.application.name=lab-crud
spring.datasource.url=jdbc:mysql://${DB_HOST:localhost}:3306/${DB_NAME:labcrud}
spring.datasource.username=${DB_USER:root}
spring.datasource.url=jdbc:h2:mem:${DB_NAME:labcrud}
spring.datasource.username=${DB_USER:sa}
spring.datasource.password=${DB_PASSWORD:password}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.config.import=optional:file:.env

0 comments on commit 4be4197

Please sign in to comment.