From 989c523308ed06ef3e799285e6d2ddeb08faacec Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Thu, 19 Mar 2020 23:06:52 +0100 Subject: [PATCH] JAVA-960: Fix conflicts --- .../baeldung/resttemplate/configuration/SpringConfig.java | 4 ---- .../baeldung/resttemplate/lists/service/EmployeeService.java | 2 +- .../baeldung/sampleapp/web/controller/MyFooController.java | 2 +- .../src/test/java/com/baeldung/SpringTestConfig.java | 5 ----- .../EmployeeServiceMockRestServiceServerUnitTest.java | 3 ++- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/configuration/SpringConfig.java b/spring-resttemplate/src/main/java/com/baeldung/resttemplate/configuration/SpringConfig.java index a97ac7d5a5..7866a4abcd 100644 --- a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/configuration/SpringConfig.java +++ b/spring-resttemplate/src/main/java/com/baeldung/resttemplate/configuration/SpringConfig.java @@ -26,8 +26,4 @@ public class SpringConfig { return new RestTemplateBuilder(customRestTemplateCustomizer()); } - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } } diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java b/spring-resttemplate/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java index 226134787f..8a1773483a 100644 --- a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java +++ b/spring-resttemplate/src/main/java/com/baeldung/resttemplate/lists/service/EmployeeService.java @@ -7,7 +7,7 @@ import com.baeldung.resttemplate.lists.dto.Employee; import java.util.ArrayList; import java.util.List; -@Service +@Service("EmployeeListService") public class EmployeeService { public List getAllEmployees() diff --git a/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java b/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java index 11ea5b70c9..5c385edb07 100644 --- a/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java +++ b/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/MyFooController.java @@ -20,7 +20,7 @@ import com.baeldung.sampleapp.web.dto.Foo; import com.baeldung.sampleapp.web.exception.ResourceNotFoundException; @Controller -@RequestMapping(value = "/foos") +@RequestMapping(value = "/foo") public class MyFooController { private final Map myfoos; diff --git a/spring-resttemplate/src/test/java/com/baeldung/SpringTestConfig.java b/spring-resttemplate/src/test/java/com/baeldung/SpringTestConfig.java index 9a32d1ee98..c626d1021d 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/SpringTestConfig.java +++ b/spring-resttemplate/src/test/java/com/baeldung/SpringTestConfig.java @@ -11,9 +11,4 @@ import org.springframework.web.client.RestTemplate; @ComponentScan("com.baeldung") public class SpringTestConfig { - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } - } diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/service/EmployeeServiceMockRestServiceServerUnitTest.java b/spring-resttemplate/src/test/java/com/baeldung/web/service/EmployeeServiceMockRestServiceServerUnitTest.java index 9fe1232231..ee01cb6a50 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/web/service/EmployeeServiceMockRestServiceServerUnitTest.java +++ b/spring-resttemplate/src/test/java/com/baeldung/web/service/EmployeeServiceMockRestServiceServerUnitTest.java @@ -16,6 +16,7 @@ import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -28,7 +29,7 @@ import org.springframework.web.client.RestTemplate; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(SpringRunner.class) -@ContextConfiguration(classes = SpringTestConfig.class) +@SpringBootTest(classes = SpringTestConfig.class) public class EmployeeServiceMockRestServiceServerUnitTest { private static final Logger logger = LoggerFactory.getLogger(EmployeeServiceMockRestServiceServerUnitTest.class);