Added examples for the @RestClientTest article, fixed mail port (#513)

This commit is contained in:
Sergey Petunin
2016-07-19 19:01:18 +06:00
committed by Grzegorz Piwowarek
parent 3efa23b6b5
commit cb8f58a9e7
6 changed files with 139 additions and 3 deletions
@@ -0,0 +1,32 @@
package org.baeldung.client;
public class Details {
private String name;
private String login;
public Details() {
}
public Details(String name, String login) {
this.name = name;
this.login = login;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
}
@@ -0,0 +1,20 @@
package org.baeldung.client;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class DetailsServiceClient {
private final RestTemplate restTemplate;
public DetailsServiceClient(RestTemplateBuilder restTemplateBuilder) {
restTemplate = restTemplateBuilder.build();
}
public Details getUserDetails(String name) {
return restTemplate.getForObject("/{name}/details", Details.class, name);
}
}