JAVA-32062 Upgrade spring-ressttemplate-1 to spring boot 3 (#16164)
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<artifactId>parent-boot-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-3</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -27,4 +27,8 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<start-class>com.baeldung.resttemplate.RestTemplateApplication</start-class>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+5
-5
@@ -46,7 +46,7 @@ public class EmployeeClient {
|
||||
|
||||
ResponseEntity<Employee[]> response =
|
||||
restTemplate.getForEntity(
|
||||
"http://localhost:8082/spring-rest/employees/",
|
||||
"http://localhost:8080/spring-rest/employees/",
|
||||
Employee[].class);
|
||||
|
||||
Employee[] employees = response.getBody();
|
||||
@@ -64,7 +64,7 @@ public class EmployeeClient {
|
||||
|
||||
ResponseEntity<List<Employee>> response =
|
||||
restTemplate.exchange(
|
||||
"http://localhost:8082/spring-rest/employees/",
|
||||
"http://localhost:8080/spring-rest/employees/",
|
||||
HttpMethod.GET,
|
||||
null,
|
||||
new ParameterizedTypeReference<List<Employee>>() {
|
||||
@@ -83,7 +83,7 @@ public class EmployeeClient {
|
||||
|
||||
EmployeeList response =
|
||||
restTemplate.getForObject(
|
||||
"http://localhost:8082/spring-rest/employees/v2",
|
||||
"http://localhost:8080/spring-rest/employees/v2",
|
||||
EmployeeList.class);
|
||||
|
||||
List<Employee> employees = response.getEmployees();
|
||||
@@ -101,7 +101,7 @@ public class EmployeeClient {
|
||||
newEmployees.add(new Employee(4, "CEO"));
|
||||
|
||||
restTemplate.postForObject(
|
||||
"http://localhost:8082/spring-rest/employees/",
|
||||
"http://localhost:8080/spring-rest/employees/",
|
||||
newEmployees,
|
||||
ResponseEntity.class);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class EmployeeClient {
|
||||
newEmployees.add(new Employee(4, "CEO"));
|
||||
|
||||
restTemplate.postForObject(
|
||||
"http://localhost:8082/spring-rest/employees/v2/",
|
||||
"http://localhost:8080/spring-rest/employees/v2",
|
||||
new EmployeeList(newEmployees),
|
||||
ResponseEntity.class);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.resttemplate.web.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baeldung.resttemplate.web.service.PersonService;
|
||||
import com.baeldung.resttemplate.web.dto.Person;
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ public class PersonAPILiveTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void runBeforeAllTestMethods() throws JSONException {
|
||||
createPersonUrl = "http://localhost:8082/spring-rest/createPerson";
|
||||
updatePersonUrl = "http://localhost:8082/spring-rest/updatePerson";
|
||||
createPersonUrl = "http://localhost:8080/spring-rest/createPerson";
|
||||
updatePersonUrl = "http://localhost:8080/spring-rest/updatePerson";
|
||||
|
||||
restTemplate = new RestTemplate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user