diff --git a/spring-boot-h2/spring-boot-h2-database/.gitignore b/spring-boot-h2/spring-boot-h2-database/.gitignore deleted file mode 100644 index 82eca336e3..0000000000 --- a/spring-boot-h2/spring-boot-h2-database/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot-h2/spring-boot-h2-database/pom.xml b/spring-boot-h2/spring-boot-h2-database/pom.xml deleted file mode 100644 index 4b660334da..0000000000 --- a/spring-boot-h2/spring-boot-h2-database/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - com.baeldung.h2db - spring-boot-h2-database - 0.0.1-SNAPSHOT - jar - - Demo Spring Boot applications that starts H2 in memory database - - - org.springframework.boot - spring-boot-starter-parent - 2.0.4.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - com.h2database - h2 - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties b/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties deleted file mode 100644 index 0591cc9e0f..0000000000 --- a/spring-boot-h2/spring-boot-h2-database/src/main/resources/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:mydb -spring.datasource.driverClassName=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= -spring.jpa.hibernate.ddl-auto=create -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console \ No newline at end of file diff --git a/spring-boot-h2/spring-boot-h2-remote-app/.gitignore b/spring-boot-h2/spring-boot-h2-remote-app/.gitignore deleted file mode 100644 index 82eca336e3..0000000000 --- a/spring-boot-h2/spring-boot-h2-remote-app/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot-h2/spring-boot-h2-remote-app/pom.xml b/spring-boot-h2/spring-boot-h2-remote-app/pom.xml deleted file mode 100644 index 8eb59d2098..0000000000 --- a/spring-boot-h2/spring-boot-h2-remote-app/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - 4.0.0 - - com.baeldung.h2db - spring-boot-h2-remote-app - 0.0.1-SNAPSHOT - jar - - Demo Spring Boot applications that access H2 in memory database created - in another Spring Boot application - - - - org.springframework.boot - spring-boot-starter-parent - 2.0.4.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - com.h2database - h2 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/main/resources/application.properties b/spring-boot-h2/spring-boot-h2-remote-app/src/main/resources/application.properties deleted file mode 100644 index 6c3446f03a..0000000000 --- a/spring-boot-h2/spring-boot-h2-remote-app/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.datasource.url=jdbc:h2:tcp://localhost:9091/mem:mydb -spring.datasource.driverClassName=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= -spring.jpa.hibernate.ddl-auto=create \ No newline at end of file diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java b/spring-boot-persistence/src/main/java/com/baeldung/h2/client/ClientSpringBootApp.java similarity index 92% rename from spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java rename to spring-boot-persistence/src/main/java/com/baeldung/h2/client/ClientSpringBootApp.java index 39e52afd2c..b42723f09a 100644 --- a/spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java +++ b/spring-boot-persistence/src/main/java/com/baeldung/h2/client/ClientSpringBootApp.java @@ -1,4 +1,4 @@ -package com.baeldung.h2db.demo; +package com.baeldung.h2.client; import java.sql.ResultSet; import java.sql.SQLException; @@ -7,10 +7,12 @@ import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @SpringBootApplication +@ComponentScan("com.baeldung.h2.client") public class ClientSpringBootApp { @Autowired diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java b/spring-boot-persistence/src/main/java/com/baeldung/h2/server/SpringBootApp.java similarity index 94% rename from spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java rename to spring-boot-persistence/src/main/java/com/baeldung/h2/server/SpringBootApp.java index 1fe080ec22..5827f9ff77 100644 --- a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java +++ b/spring-boot-persistence/src/main/java/com/baeldung/h2/server/SpringBootApp.java @@ -1,4 +1,4 @@ -package com.baeldung.h2db.demo; +package com.baeldung.h2.server; import java.sql.ResultSet; import java.sql.SQLException; @@ -9,10 +9,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @SpringBootApplication +@ComponentScan("com.baeldung.h2.server") public class SpringBootApp { @Autowired diff --git a/spring-boot-persistence/src/main/resources/application.properties b/spring-boot-persistence/src/main/resources/application.properties index d0fb785fe8..f1394d2f8d 100644 --- a/spring-boot-persistence/src/main/resources/application.properties +++ b/spring-boot-persistence/src/main/resources/application.properties @@ -1,2 +1,8 @@ spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=none \ No newline at end of file +spring.jpa.hibernate.ddl-auto=none + + +spring.datasource.url=jdbc:h2:tcp://localhost:9091/mem:mydb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= \ No newline at end of file