Skip to content

Commit

Permalink
added some new constructors for simpler restTemplate injection
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed Jul 5, 2018
1 parent 1de3c68 commit b58f820
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

public class ForgotPasswordResource implements BaseRestResource {

private String baseAuthApiUrl;
private RestTemplate restTemplate;
protected String baseAuthApiUrl;
protected RestTemplate restTemplate;

public ForgotPasswordResource(String baseAuthApiUrl) {
this(baseAuthApiUrl, null);
}

public ForgotPasswordResource(String baseAuthApiUrl, RestTemplate restTemplate) {
Assert.hasText(baseAuthApiUrl, "baseAuthApiUrl is required");
this.baseAuthApiUrl = baseAuthApiUrl;
this.restTemplate = restTemplate;
}

protected RestTemplate getRestTemplate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

public class RegistrationResource implements BaseRestResource {

private String baseAuthApiUrl;
private RestTemplate restTemplate;
protected String baseAuthApiUrl;
protected RestTemplate restTemplate;

public RegistrationResource(String baseAuthApiUrl) {
this(baseAuthApiUrl, null);
}

public RegistrationResource(String baseAuthApiUrl, RestTemplate restTemplate) {
Assert.hasText(baseAuthApiUrl, "baseAuthApiUrl is required");
this.baseAuthApiUrl = baseAuthApiUrl;
this.restTemplate = restTemplate;
}

protected RestTemplate getRestTemplate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

public class ValidationResource implements BaseRestResource {

private String baseAuthApiUrl;
private RestTemplate restTemplate;
protected String baseAuthApiUrl;
protected RestTemplate restTemplate;

public ValidationResource(String baseAuthApiUrl) {
this(baseAuthApiUrl, null);
}

public ValidationResource(String baseAuthApiUrl, RestTemplate restTemplate) {
Assert.hasText(baseAuthApiUrl, "baseAuthApiUrl is required");
this.baseAuthApiUrl = baseAuthApiUrl;
this.restTemplate = restTemplate;
}

protected RestTemplate getRestTemplate() {
Expand Down

0 comments on commit b58f820

Please sign in to comment.