[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:
parent
aff7d722b1
commit
c23f0d6b1f
@ -44,6 +44,7 @@
|
|||||||
<module>spring-rest-simple</module>
|
<module>spring-rest-simple</module>
|
||||||
<module>spring-rest-testing</module>
|
<module>spring-rest-testing</module>
|
||||||
<module>spring-resttemplate</module>
|
<module>spring-resttemplate</module>
|
||||||
|
<module>spring-resttemplate-1</module>
|
||||||
<module>spring-resttemplate-2</module>
|
<module>spring-resttemplate-2</module>
|
||||||
<module>spring-resttemplate-3</module>
|
<module>spring-resttemplate-3</module>
|
||||||
<module>spring-session</module>
|
<module>spring-session</module>
|
||||||
|
7
spring-web-modules/spring-resttemplate-1/README.md
Normal file
7
spring-web-modules/spring-resttemplate-1/README.md
Normal 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)
|
30
spring-web-modules/spring-resttemplate-1/pom.xml
Normal file
30
spring-web-modules/spring-resttemplate-1/pom.xml
Normal 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>
|
@ -1,16 +1,17 @@
|
|||||||
package com.baeldung.resttemplate.lists.client;
|
package com.baeldung.resttemplate.lists.client;
|
||||||
|
|
||||||
import com.baeldung.resttemplate.lists.dto.Employee;
|
import static java.util.Arrays.asList;
|
||||||
import com.baeldung.resttemplate.lists.dto.EmployeeList;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.baeldung.resttemplate.lists.dto.Employee;
|
||||||
import java.util.List;
|
import com.baeldung.resttemplate.lists.dto.EmployeeList;
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application that shows how to use Lists with RestTemplate.
|
* Application that shows how to use Lists with RestTemplate.
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.resttemplate.lists.controller;
|
package com.baeldung.resttemplate.lists.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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.dto.EmployeeList;
|
||||||
import com.baeldung.resttemplate.lists.service.EmployeeService;
|
import com.baeldung.resttemplate.lists.service.EmployeeService;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/employees")
|
@RequestMapping("/employees")
|
||||||
public class EmployeeResource
|
public class EmployeeResource
|
@ -1,12 +1,12 @@
|
|||||||
package com.baeldung.resttemplate.lists.service;
|
package com.baeldung.resttemplate.lists.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baeldung.resttemplate.lists.dto.Employee;
|
import com.baeldung.resttemplate.lists.dto.Employee;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service("EmployeeListService")
|
@Service("EmployeeListService")
|
||||||
public class EmployeeService
|
public class EmployeeService
|
||||||
{
|
{
|
@ -0,0 +1,2 @@
|
|||||||
|
server.port=8080
|
||||||
|
server.servlet.context-path=/spring-rest
|
@ -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
|
@ -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>
|
@ -7,7 +7,6 @@ This module contains articles about Spring RestTemplate
|
|||||||
- [Spring RestTemplate Request/Response Logging](https://www.baeldung.com/spring-resttemplate-logging)
|
- [Spring RestTemplate Request/Response Logging](https://www.baeldung.com/spring-resttemplate-logging)
|
||||||
- [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy)
|
- [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)
|
- [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)
|
- [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)
|
- [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)
|
- [Spring RestTemplate Exception: “Not enough variables available to expand”](https://www.baeldung.com/spring-not-enough-variables-available)
|
||||||
|
@ -7,7 +7,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
- [Uploading MultipartFile with Spring RestTemplate](https://www.baeldung.com/spring-rest-template-multipart-upload)
|
- [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)
|
- [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)
|
- [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)
|
- [Encoding of URI Variables on RestTemplate](https://www.baeldung.com/spring-resttemplate-uri-variables-encode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user