[JAVA-26374-spring-resttemplate] Moved "RestTemplate Post Request wit… (#15104)

* [JAVA-26374-spring-resttemplate] Moved "RestTemplate Post Request with JSON" to spring-resttemplate-1

* [JAVA-26374] Moved "Get and Post Lists of Objects with RestTemplate" article to spring-resttemplate-1
This commit is contained in:
panos-kakos 2023-11-22 10:28:23 +00:00 committed by GitHub
parent aff7d722b1
commit c23f0d6b1f
22 changed files with 69 additions and 13 deletions

View File

@ -44,6 +44,7 @@
<module>spring-rest-simple</module>
<module>spring-rest-testing</module>
<module>spring-resttemplate</module>
<module>spring-resttemplate-1</module>
<module>spring-resttemplate-2</module>
<module>spring-resttemplate-3</module>
<module>spring-session</module>

View File

@ -0,0 +1,7 @@
## Spring RestTemplate
This module contains articles about Spring RestTemplate
### Relevant Articles:
- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json)
- [Get and Post Lists of Objects with RestTemplate](https://www.baeldung.com/spring-rest-template-list)

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-resttemplate-1</artifactId>
<version>0.1-SNAPSHOT</version>
<name>spring-resttemplate-1</name>
<packaging>war</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<dependencies>
<!-- Spring Boot Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,16 +1,17 @@
package com.baeldung.resttemplate.lists.client;
import com.baeldung.resttemplate.lists.dto.Employee;
import com.baeldung.resttemplate.lists.dto.EmployeeList;
import static java.util.Arrays.asList;
import java.util.ArrayList;
import java.util.List;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
import static java.util.Arrays.asList;
import com.baeldung.resttemplate.lists.dto.Employee;
import com.baeldung.resttemplate.lists.dto.EmployeeList;
/**
* Application that shows how to use Lists with RestTemplate.

View File

@ -1,5 +1,7 @@
package com.baeldung.resttemplate.lists.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -10,8 +12,6 @@ import com.baeldung.resttemplate.lists.dto.Employee;
import com.baeldung.resttemplate.lists.dto.EmployeeList;
import com.baeldung.resttemplate.lists.service.EmployeeService;
import java.util.List;
@RestController
@RequestMapping("/employees")
public class EmployeeResource

View File

@ -1,12 +1,12 @@
package com.baeldung.resttemplate.lists.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baeldung.resttemplate.lists.dto.Employee;
import java.util.ArrayList;
import java.util.List;
@Service("EmployeeListService")
public class EmployeeService
{

View File

@ -0,0 +1,2 @@
server.port=8080
server.servlet.context-path=/spring-rest

View File

@ -0,0 +1,5 @@
logging.level.org.springframework.web.client.RestTemplate=DEBUG
logging.level.com.baeldung.resttemplate.logging=DEBUG
logging.level.org.apache.http=DEBUG
logging.level.httpclient.wire=DEBUG
logging.pattern.console=%20logger{20} - %msg%n

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="15 seconds" debug="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{ISO8601}]-[%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -7,7 +7,6 @@ This module contains articles about Spring RestTemplate
- [Spring RestTemplate Request/Response Logging](https://www.baeldung.com/spring-resttemplate-logging)
- [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy)
- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type)
- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json)
- [How to Compress Requests Using the Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-compressing-requests)
- [Get list of JSON objects with Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-json-list)
- [Spring RestTemplate Exception: “Not enough variables available to expand”](https://www.baeldung.com/spring-not-enough-variables-available)

View File

@ -7,7 +7,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
- [Uploading MultipartFile with Spring RestTemplate](https://www.baeldung.com/spring-rest-template-multipart-upload)
- [Get and Post Lists of Objects with RestTemplate](https://www.baeldung.com/spring-rest-template-list)
- [Download a Large File Through a Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-download-large-file)
- [Access HTTPS REST Service Using Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-secure-https-service)
- [Encoding of URI Variables on RestTemplate](https://www.baeldung.com/spring-resttemplate-uri-variables-encode)