diff --git a/pom.xml b/pom.xml
index 452c7838f7..bca9f953c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -259,6 +259,7 @@
java-spi
performance-tests
twilio
+ spring-boot-ctx-fluent
diff --git a/spring-boot-ctx-fluent/pom.xml b/spring-boot-ctx-fluent/pom.xml
index 5e308a0134..6d767f9ef7 100644
--- a/spring-boot-ctx-fluent/pom.xml
+++ b/spring-boot-ctx-fluent/pom.xml
@@ -3,25 +3,26 @@
4.0.0
com.baeldung
- ctxexample
+ spring-boot-ctx-fluent
0.0.1-SNAPSHOT
jar
- ctxexample
- http://maven.apache.org
+
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
+
-
- UTF-8
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.0.RELEASE
-
org.springframework.boot
spring-boot-starter-web
+
+
+ UTF-8
+
+
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/App.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/App.java
deleted file mode 100644
index da552a264b..0000000000
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/App.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.baeldung;
-
-import org.springframework.boot.WebApplicationType;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-
-import com.baeldung.rest.RestConfig;
-import com.baeldung.services.ServiceConfig;
-import com.baeldung.web.WebConfig;
-
-@SpringBootApplication
-public class App {
- public static void main(String[] args) {
- new SpringApplicationBuilder().parent(ServiceConfig.class)
- .web(WebApplicationType.NONE)
- .child(WebConfig.class)
- .web(WebApplicationType.SERVLET)
- .sibling(RestConfig.class)
- .web(WebApplicationType.SERVLET)
- .run(args);
- }
-}
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/WebConfig.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Config.java
similarity index 71%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/web/WebConfig.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Config.java
index 0b0a9a18f6..0bacc5e8fe 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/WebConfig.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Config.java
@@ -1,4 +1,4 @@
-package com.baeldung.web;
+package com.baeldung.ctx1;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
@@ -6,16 +6,17 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
-import com.baeldung.services.IHomeService;
+import com.baeldung.parent.IHomeService;
@Configuration
-@ComponentScan("com.baeldung.web")
+@ComponentScan("com.baeldung.ctx1")
+@PropertySource("classpath:ctx1.properties")
@EnableAutoConfiguration
-@PropertySource("classpath:web-app.properties")
-public class WebConfig {
+public class Ctx1Config {
@Bean
public IHomeService homeService() {
return new GreetingService();
}
+
}
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/HomeController.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java
similarity index 80%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/web/HomeController.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java
index 622470107d..9c7667db35 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/HomeController.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java
@@ -1,14 +1,14 @@
-package com.baeldung.web;
+package com.baeldung.ctx1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-import com.baeldung.services.IHomeService;
+import com.baeldung.parent.IHomeService;
@Controller
-public class HomeController {
+public class Ctx1Controller {
@Autowired
IHomeService homeService;
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/GreetingService.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/GreetingService.java
similarity index 74%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/web/GreetingService.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/GreetingService.java
index 1782b35489..a0f1f16288 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/web/GreetingService.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/GreetingService.java
@@ -1,8 +1,8 @@
-package com.baeldung.web;
+package com.baeldung.ctx1;
import org.springframework.stereotype.Service;
-import com.baeldung.services.IHomeService;
+import com.baeldung.parent.IHomeService;
@Service
public class GreetingService implements IHomeService {
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/RestConfig.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Config.java
similarity index 68%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/RestConfig.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Config.java
index 77b78d01b6..fc08b741f3 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/RestConfig.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Config.java
@@ -1,4 +1,4 @@
-package com.baeldung.rest;
+package com.baeldung.ctx2;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
@@ -6,9 +6,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
-@ComponentScan("com.baeldung.rest")
+@ComponentScan("com.baeldung.ctx2")
@EnableAutoConfiguration
-@PropertySource("classpath:rest-app.properties")
-public class RestConfig {
+@PropertySource("classpath:ctx2.properties")
+public class Ctx2Config {
}
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/GreetingController.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java
similarity index 79%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/GreetingController.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java
index 563a374dd1..850fd8021c 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/rest/GreetingController.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java
@@ -1,13 +1,13 @@
-package com.baeldung.rest;
+package com.baeldung.ctx2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.baeldung.services.IHomeService;
+import com.baeldung.parent.IHomeService;
@RestController
-public class GreetingController {
+public class Ctx2Controller {
@Autowired
IHomeService homeService;
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/App.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/App.java
new file mode 100644
index 0000000000..609751bc0f
--- /dev/null
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/App.java
@@ -0,0 +1,19 @@
+package com.baeldung.parent;
+
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+import com.baeldung.ctx1.Ctx1Config;
+import com.baeldung.ctx2.Ctx2Config;
+
+public class App {
+ public static void main(String[] args) {
+ new SpringApplicationBuilder().parent(ParentConfig.class)
+ .web(WebApplicationType.NONE)
+ .child(Ctx1Config.class)
+ .web(WebApplicationType.SERVLET)
+ .sibling(Ctx2Config.class)
+ .web(WebApplicationType.SERVLET)
+ .run(args);
+ }
+}
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/HomeService.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/HomeService.java
similarity index 85%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/services/HomeService.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/HomeService.java
index c1cbe027ee..0d23e26cce 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/HomeService.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/HomeService.java
@@ -1,4 +1,4 @@
-package com.baeldung.services;
+package com.baeldung.parent;
import org.springframework.stereotype.Service;
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/IHomeService.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/IHomeService.java
similarity index 66%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/services/IHomeService.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/IHomeService.java
index 0386e13c0b..264e49861a 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/IHomeService.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/IHomeService.java
@@ -1,4 +1,4 @@
-package com.baeldung.services;
+package com.baeldung.parent;
public interface IHomeService {
diff --git a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/ServiceConfig.java b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/ParentConfig.java
similarity index 57%
rename from spring-boot-ctx-fluent/src/main/java/com/baeldung/services/ServiceConfig.java
rename to spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/ParentConfig.java
index 6f98bb0457..484d020cc0 100644
--- a/spring-boot-ctx-fluent/src/main/java/com/baeldung/services/ServiceConfig.java
+++ b/spring-boot-ctx-fluent/src/main/java/com/baeldung/parent/ParentConfig.java
@@ -1,8 +1,8 @@
-package com.baeldung.services;
+package com.baeldung.parent;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ComponentScan("com.baeldung.services")
-public class ServiceConfig {}
+@ComponentScan("com.baeldung.parent")
+public class ParentConfig {}
diff --git a/spring-boot-ctx-fluent/src/main/resources/application.properties b/spring-boot-ctx-fluent/src/main/resources/application.properties
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/spring-boot-ctx-fluent/src/main/resources/rest-app.properties b/spring-boot-ctx-fluent/src/main/resources/ctx1.properties
similarity index 66%
rename from spring-boot-ctx-fluent/src/main/resources/rest-app.properties
rename to spring-boot-ctx-fluent/src/main/resources/ctx1.properties
index dc5a463238..2b618d4177 100644
--- a/spring-boot-ctx-fluent/src/main/resources/rest-app.properties
+++ b/spring-boot-ctx-fluent/src/main/resources/ctx1.properties
@@ -1,5 +1,5 @@
server.port=8081
-server.servlet.context-path=/rest
+server.servlet.context-path=/ctx1
#logging.level=debug
spring.application.admin.enabled=false
spring.application.admin.jmx-name=org.springframework.boot:type=AdminRest,name=SpringRestApplication
\ No newline at end of file
diff --git a/spring-boot-ctx-fluent/src/main/resources/web-app.properties b/spring-boot-ctx-fluent/src/main/resources/ctx2.properties
similarity index 54%
rename from spring-boot-ctx-fluent/src/main/resources/web-app.properties
rename to spring-boot-ctx-fluent/src/main/resources/ctx2.properties
index 2b81875901..f3599e17e0 100644
--- a/spring-boot-ctx-fluent/src/main/resources/web-app.properties
+++ b/spring-boot-ctx-fluent/src/main/resources/ctx2.properties
@@ -1,3 +1,5 @@
-server.port=8080
+server.port=8082
+server.servlet.context-path=/ctx2
+
spring.application.admin.enabled=false
spring.application.admin.jmx-name=org.springframework.boot:type=WebAdmin,name=SpringWebApplication
\ No newline at end of file