JAVA-32062 Upgrade spring-ressttemplate-1 to spring boot 3 (#16164)
This commit is contained in:
parent
317496fa87
commit
53b3bca14d
|
@ -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>
|
|
@ -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,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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue