diff --git a/src/main/java/guru/springframework/sfgdi/controllers/ConstructorInjectedController.java b/src/main/java/guru/springframework/sfgdi/controllers/ConstructorInjectedController.java index ad3f58c6b3..55324ca6ec 100644 --- a/src/main/java/guru/springframework/sfgdi/controllers/ConstructorInjectedController.java +++ b/src/main/java/guru/springframework/sfgdi/controllers/ConstructorInjectedController.java @@ -4,14 +4,11 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; -/** - * Created by jt on 12/26/19. - */ @Controller public class ConstructorInjectedController { private final GreetingService greetingService; - public ConstructorInjectedController(@Qualifier("constructorGreetingService") GreetingService greetingService) { + public ConstructorInjectedController(@Qualifier("constructorInjectedGreetingService") GreetingService greetingService) { this.greetingService = greetingService; } diff --git a/src/main/java/guru/springframework/sfgdi/services/ConstructorGreetingService.java b/src/main/java/guru/springframework/sfgdi/services/ConstructorInjectedGreetingService.java similarity index 75% rename from src/main/java/guru/springframework/sfgdi/services/ConstructorGreetingService.java rename to src/main/java/guru/springframework/sfgdi/services/ConstructorInjectedGreetingService.java index a546a690be..77e8065dca 100644 --- a/src/main/java/guru/springframework/sfgdi/services/ConstructorGreetingService.java +++ b/src/main/java/guru/springframework/sfgdi/services/ConstructorInjectedGreetingService.java @@ -6,7 +6,7 @@ * Created by jt on 12/26/19. */ @Service -public class ConstructorGreetingService implements GreetingService { +public class ConstructorInjectedGreetingService implements GreetingService { @Override public String sayGreeting() { return "Hello World - Constructor"; diff --git a/src/main/java/guru/springframework/sfgdi/services/I18NSpanishService.java b/src/main/java/guru/springframework/sfgdi/services/I18NSpanishService.java index 9a69b4bbbe..0732a2bf1a 100644 --- a/src/main/java/guru/springframework/sfgdi/services/I18NSpanishService.java +++ b/src/main/java/guru/springframework/sfgdi/services/I18NSpanishService.java @@ -3,10 +3,7 @@ import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; -/** - * Created by jt on 12/27/19. - */ -@Profile("ES") +@Profile({"ES", "default"}) @Service("i18nService") public class I18NSpanishService implements GreetingService { @Override diff --git a/src/main/java/guru/springframework/sfgdi/services/I18nEnglishGreetingService.java b/src/main/java/guru/springframework/sfgdi/services/I18nEnglishGreetingService.java index 0b56d78eb5..81a6cade70 100644 --- a/src/main/java/guru/springframework/sfgdi/services/I18nEnglishGreetingService.java +++ b/src/main/java/guru/springframework/sfgdi/services/I18nEnglishGreetingService.java @@ -3,9 +3,6 @@ import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; -/** - * Created by jt on 12/27/19. - */ @Profile("EN") @Service("i18nService") public class I18nEnglishGreetingService implements GreetingService { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6ad22a0fcf..f925173f32 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1 @@ -spring.profiles.active=ES +#spring.profiles.active=EN diff --git a/src/test/java/guru/springframework/sfgdi/controllers/ConstructorInjectedControllerTest.java b/src/test/java/guru/springframework/sfgdi/controllers/ConstructorInjectedControllerTest.java index acc66b3939..cb40173d60 100644 --- a/src/test/java/guru/springframework/sfgdi/controllers/ConstructorInjectedControllerTest.java +++ b/src/test/java/guru/springframework/sfgdi/controllers/ConstructorInjectedControllerTest.java @@ -1,6 +1,6 @@ package guru.springframework.sfgdi.controllers; -import guru.springframework.sfgdi.services.ConstructorGreetingService; +import guru.springframework.sfgdi.services.ConstructorInjectedGreetingService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -10,7 +10,7 @@ class ConstructorInjectedControllerTest { @BeforeEach void setUp() { - controller = new ConstructorInjectedController(new ConstructorGreetingService()); + controller = new ConstructorInjectedController(new ConstructorInjectedGreetingService()); } @Test diff --git a/src/test/java/guru/springframework/sfgdi/controllers/PropertyInjectedControllerTest.java b/src/test/java/guru/springframework/sfgdi/controllers/PropertyInjectedControllerTest.java index a22af87a3f..50714036d0 100644 --- a/src/test/java/guru/springframework/sfgdi/controllers/PropertyInjectedControllerTest.java +++ b/src/test/java/guru/springframework/sfgdi/controllers/PropertyInjectedControllerTest.java @@ -1,6 +1,6 @@ package guru.springframework.sfgdi.controllers; -import guru.springframework.sfgdi.services.ConstructorGreetingService; +import guru.springframework.sfgdi.services.PropertyInjectedGreetingService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -12,7 +12,7 @@ class PropertyInjectedControllerTest { void setUp() { controller = new PropertyInjectedController(); - controller.greetingService = new ConstructorGreetingService(); + controller.greetingService = new PropertyInjectedGreetingService(); } @Test diff --git a/src/test/java/guru/springframework/sfgdi/controllers/SetterInjectedControllerTest.java b/src/test/java/guru/springframework/sfgdi/controllers/SetterInjectedControllerTest.java index c82e100c4f..791dfe3fe5 100644 --- a/src/test/java/guru/springframework/sfgdi/controllers/SetterInjectedControllerTest.java +++ b/src/test/java/guru/springframework/sfgdi/controllers/SetterInjectedControllerTest.java @@ -1,6 +1,6 @@ package guru.springframework.sfgdi.controllers; -import guru.springframework.sfgdi.services.ConstructorGreetingService; +import guru.springframework.sfgdi.services.SetterInjectedGreetingService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -11,7 +11,7 @@ class SetterInjectedControllerTest { @BeforeEach void setUp() { controller = new SetterInjectedController(); - controller.setGreetingService(new ConstructorGreetingService()); + controller.setGreetingService(new SetterInjectedGreetingService()); } @Test