Switched from Dropwizard to Springboot
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / aai / AaiQuery.java
index 4a4ffcb..1bf79f2 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017 - 2021 ZTE Corporation.
  * <p>
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  * in compliance with the License. You may obtain a copy of the License at
 package org.onap.holmes.common.aai;
 
 import lombok.extern.slf4j.Slf4j;
-import org.jvnet.hk2.annotations.Service;
 import org.onap.holmes.common.aai.config.AaiConfig;
 import org.onap.holmes.common.aai.entity.VmEntity;
 import org.onap.holmes.common.aai.entity.VnfEntity;
 import org.onap.holmes.common.exception.CorrelationException;
 import org.onap.holmes.common.utils.JerseyClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
-import javax.inject.Inject;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +30,7 @@ import java.util.Map;
 @Slf4j
 public class AaiQuery {
 
-    @Inject
+    @Autowired
     private AaiResponseUtil aaiResponseUtil;
 
     public VnfEntity getAaiVnfData(String vnfId, String vnfName) throws CorrelationException {
@@ -92,7 +92,7 @@ public class AaiQuery {
 
     private String getResponse(String url) throws CorrelationException {
         try {
-            return new JerseyClient().headers(getHeaders()).get(url);
+            return JerseyClient.newInstance().headers(getHeaders()).get(url);
         } catch (Exception e) {
             throw new CorrelationException("Failed to get data from aai", e);
         }