Skip to content

Commit e16918c

Browse files
author
mayur.patel
committed
added H2 shared db example
1 parent ed56ede commit e16918c

9 files changed

Lines changed: 13 additions & 172 deletions

File tree

‎spring-boot-h2/spring-boot-h2-database/.gitignore‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎spring-boot-h2/spring-boot-h2-database/pom.xml‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

‎spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎spring-boot-h2/spring-boot-h2-remote-app/.gitignore‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎spring-boot-h2/spring-boot-h2-remote-app/pom.xml‎

Lines changed: 0 additions & 55 deletions
This file was deleted.

‎spring-boot-h2/spring-boot-h2-remote-app/src/main/resources/application.properties‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java renamed to spring-boot-persistence/src/main/java/com/baeldung/h2/client/ClientSpringBootApp.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.h2db.demo;
1+
package com.baeldung.h2.client;
22

33
import java.sql.ResultSet;
44
import java.sql.SQLException;
@@ -7,10 +7,12 @@
77
import org.springframework.beans.factory.annotation.Autowired;
88
import org.springframework.boot.SpringApplication;
99
import org.springframework.boot.autoconfigure.SpringBootApplication;
10+
import org.springframework.context.annotation.ComponentScan;
1011
import org.springframework.jdbc.core.JdbcTemplate;
1112
import org.springframework.jdbc.core.RowMapper;
1213

1314
@SpringBootApplication
15+
@ComponentScan("com.baeldung.h2.client")
1416
public class ClientSpringBootApp {
1517

1618
@Autowired

spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java renamed to spring-boot-persistence/src/main/java/com/baeldung/h2/server/SpringBootApp.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.h2db.demo;
1+
package com.baeldung.h2.server;
22

33
import java.sql.ResultSet;
44
import java.sql.SQLException;
@@ -9,10 +9,12 @@
99
import org.springframework.boot.SpringApplication;
1010
import org.springframework.boot.autoconfigure.SpringBootApplication;
1111
import org.springframework.context.annotation.Bean;
12+
import org.springframework.context.annotation.ComponentScan;
1213
import org.springframework.jdbc.core.JdbcTemplate;
1314
import org.springframework.jdbc.core.RowMapper;
1415

1516
@SpringBootApplication
17+
@ComponentScan("com.baeldung.h2.server")
1618
public class SpringBootApp {
1719

1820
@Autowired
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
spring.jpa.show-sql=true
2-
spring.jpa.hibernate.ddl-auto=none
2+
spring.jpa.hibernate.ddl-auto=none
3+
4+
5+
spring.datasource.url=jdbc:h2:tcp://localhost:9091/mem:mydb
6+
spring.datasource.driverClassName=org.h2.Driver
7+
spring.datasource.username=sa
8+
spring.datasource.password=

0 commit comments

Comments
 (0)