From 5a45a939a028d8bea5abf354f30c72f099a12e23 Mon Sep 17 00:00:00 2001 From: seokjun jeon Date: Mon, 13 Jan 2025 14:58:34 +0900 Subject: [PATCH] 20250113_9 --- .../java/com/icomsys/MessagingConnector.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/icomsys/MessagingConnector.java b/src/main/java/com/icomsys/MessagingConnector.java index 63abf0d..a11b031 100644 --- a/src/main/java/com/icomsys/MessagingConnector.java +++ b/src/main/java/com/icomsys/MessagingConnector.java @@ -9,7 +9,6 @@ import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationContext; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.*; import org.springframework.stereotype.Service; @@ -17,7 +16,6 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.time.LocalDate; @@ -28,34 +26,27 @@ import java.util.UUID; @Service public class MessagingConnector { - public RestTemplate restTemplate; + private final RestTemplate restTemplate; - private String sms; + private final MessageSendServiceDsl messageSendServiceDsl; - private String lms; + private final String sms; - private String mms; + private final String lms; - private String kakao; + private final String mms; - private String apiKey; + private final String kakao; - @Autowired - private ApplicationContext applicationContext; + private final String apiKey; - private MessageSendServiceDsl messageSendServiceDsl; - - @PostConstruct - public void init() { - this.messageSendServiceDsl = applicationContext.getBean(MessageSendServiceDsl.class); - } - - public MessagingConnector(String sms, String lms,String mms,String kakao,String apiKey){ + public MessagingConnector(String sms, String lms,String mms,String kakao,String apiKey, MessageSendServiceDsl messageSendServiceDsl){ this.sms = sms; this.lms = lms; this.mms = mms; this.kakao = kakao; this.apiKey = apiKey; + this.messageSendServiceDsl = messageSendServiceDsl; this.restTemplate = new RestTemplate(); }