Refactor AuthService to use default RestTemplate and ObjectMapper

Replaces constructor-based dependency injection with direct instantiation of RestTemplate and ObjectMapper in AuthService. Simplifies the class by removing the constructor and initializing dependencies inline.
ACONNECT-DEPOSITACCOUNT-API
Naeem Ullah 4 weeks ago
parent 10084bbd48
commit 29a5e2f5e1

@ -19,13 +19,8 @@ public class AuthService {
@Value("${app.security.uri}")
private String securityURI;
private final RestTemplate restTemplate;
private final ObjectMapper objectMapper;
public AuthService(RestTemplate restTemplate, ObjectMapper objectMapper) {
this.restTemplate = restTemplate;
this.objectMapper = objectMapper;
}
private final RestTemplate restTemplate = new RestTemplate();
private final ObjectMapper objectMapper = new ObjectMapper();
public Map<String, Object> authenticate(Map<String, String> payload) {

@ -0,0 +1,15 @@
package com.mfsys.aconnect.configuration.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate(new HttpComponentsClientHttpRequestFactory());
}
}
Loading…
Cancel
Save