diff --git a/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java b/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java index 9c7667db35..2de42251e4 100644 --- a/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java +++ b/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx1/Ctx1Controller.java @@ -1,22 +1,18 @@ 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.parent.IHomeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; -@Controller +@RestController public class Ctx1Controller { @Autowired - IHomeService homeService; + private IHomeService homeService; @GetMapping("/home") - @ResponseBody public String greeting() { - return homeService.getGreeting(); } } diff --git a/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java b/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java index 850fd8021c..65790141bb 100644 --- a/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java +++ b/spring-boot-modules/spring-boot-ctx-fluent/src/main/java/com/baeldung/ctx2/Ctx2Controller.java @@ -1,18 +1,17 @@ package com.baeldung.ctx2; +import com.baeldung.parent.IHomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; -import com.baeldung.parent.IHomeService; - @RestController public class Ctx2Controller { @Autowired - IHomeService homeService; + private IHomeService homeService; - @GetMapping(value = "/greeting", produces = "application/json") + @GetMapping(value = "/greeting") public String getGreeting() { return homeService.getGreeting(); } diff --git a/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx1.properties b/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx1.properties index 2b618d4177..d0af43abdd 100644 --- a/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx1.properties +++ b/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx1.properties @@ -1,4 +1,4 @@ -server.port=8081 +server.port=8074 server.servlet.context-path=/ctx1 #logging.level=debug spring.application.admin.enabled=false diff --git a/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx2.properties b/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx2.properties index f3599e17e0..7cd48d2f07 100644 --- a/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx2.properties +++ b/spring-boot-modules/spring-boot-ctx-fluent/src/main/resources/ctx2.properties @@ -1,4 +1,4 @@ -server.port=8082 +server.port=8075 server.servlet.context-path=/ctx2 spring.application.admin.enabled=false diff --git a/spring-boot-modules/spring-boot-ctx-fluent/src/test/java/com/baeldung/SpringContextTest.java b/spring-boot-modules/spring-boot-ctx-fluent/src/test/java/com/baeldung/SpringContextTest.java index ca8989724b..07242452bf 100644 --- a/spring-boot-modules/spring-boot-ctx-fluent/src/test/java/com/baeldung/SpringContextTest.java +++ b/spring-boot-modules/spring-boot-ctx-fluent/src/test/java/com/baeldung/SpringContextTest.java @@ -7,7 +7,7 @@ import com.baeldung.parent.App; public class SpringContextTest { @Test - public final void testMain() throws Exception { + public final void testMain() { App.main(new String[] {}); } }