diff --git a/pom.xml b/pom.xml
index bd06bdfdaa..f4f09b427e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -675,7 +675,7 @@
spring-boot-custom-starter/greeter
spring-boot-h2/spring-boot-h2-database
- spring-boot-h2/spring-boot-h2-remote-app
+
@@ -992,7 +992,7 @@
spring-boot-custom-starter/greeter
spring-boot-h2/spring-boot-h2-database
- spring-boot-h2/spring-boot-h2-remote-app
+
diff --git a/spring-boot-h2/spring-boot-h2-database/pom.xml b/spring-boot-h2/spring-boot-h2-database/pom.xml
index 4b660334da..94f2293c34 100644
--- a/spring-boot-h2/spring-boot-h2-database/pom.xml
+++ b/spring-boot-h2/spring-boot-h2-database/pom.xml
@@ -22,6 +22,8 @@
UTF-8
UTF-8
1.8
+
+ com.mycorp.starter.HelloWorldApplication
diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java
similarity index 85%
rename from spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java
rename to spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java
index 39e52afd2c..7402312e1c 100644
--- a/spring-boot-h2/spring-boot-h2-remote-app/src/main/java/com/baeldung/h2db/demo/ClientSpringBootApp.java
+++ b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/client/ClientSpringBootApp.java
@@ -1,4 +1,4 @@
-package com.baeldung.h2db.demo;
+package com.baeldung.h2db.demo.client;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -7,16 +7,20 @@ 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.context.annotation.PropertySource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
@SpringBootApplication
+@ComponentScan("com.baeldung.h2db.demo.client")
public class ClientSpringBootApp {
@Autowired
private JdbcTemplate jdbcTemplate;
public static void main(String[] args) {
+ System.setProperty("spring.datasource.url","jdbc:h2:tcp://localhost:9091/mem:mydb");
SpringApplication.run(ClientSpringBootApp.class, args);
}
@@ -46,4 +50,4 @@ public class ClientSpringBootApp {
}
});
}
-}
\ No newline at end of file
+}
diff --git a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java
similarity index 88%
rename from spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java
rename to spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java
index 1fe080ec22..e75b42a934 100644
--- a/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/SpringBootApp.java
+++ b/spring-boot-h2/spring-boot-h2-database/src/main/java/com/baeldung/h2db/demo/server/SpringBootApp.java
@@ -1,4 +1,4 @@
-package com.baeldung.h2db.demo;
+package com.baeldung.h2db.demo.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.h2db.demo.server")
public class SpringBootApp {
@Autowired
@@ -24,8 +26,7 @@ public class SpringBootApp {
@PostConstruct
private void initDb() {
- System.out.println(String.format(
- "****** Creating table: %s, and Inserting test data ******", "Employees"));
+ System.out.println(String.format("****** Creating table: %s, and Inserting test data ******", "Employees"));
String sqlStatements[] = {
"drop table employees if exists",
@@ -57,4 +58,4 @@ public class SpringBootApp {
public Server inMemoryH2DatabaseServer() throws SQLException {
return Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9091");
}
-}
\ 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