fix bug: exception when aai enrichment is false
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / dcae-analytics-tca-web / src / main / java / org / onap / dcae / analytics / tca / web / config / TcaAaiConfig.java
index 4ec42d5..d2ed48c 100644 (file)
 package org.onap.dcae.analytics.tca.web.config;
 
 import org.onap.dcae.analytics.tca.core.service.TcaAaiEnrichmentContext;
-import org.onap.dcae.analytics.tca.core.service.TcaAaiEnrichmentService;
 import org.onap.dcae.analytics.tca.web.TcaAppProperties;
 import org.onap.dcae.analytics.tca.web.aai.TcaAaiEnrichmentContextImpl;
-import org.onap.dcae.analytics.tca.web.aai.TcaAaiEnrichmentServiceImpl;
-import org.onap.dcae.analytics.tca.web.aai.TcaAaiRestClientPreferences;
-import org.onap.dcae.analytics.tca.web.util.function.TcaAppPropsToAaiRestClientPrefsFunction;
-import org.onap.dcae.analytics.web.http.HttpClientPreferencesCustomizer;
 import org.springframework.boot.web.client.RestTemplateBuilder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.web.client.RestTemplate;
 
 /**
  * @author Rajiv Singla
@@ -38,36 +32,10 @@ import org.springframework.web.client.RestTemplate;
 @Configuration
 public class TcaAaiConfig {
 
-    @Bean
-    public TcaAaiRestClientPreferences aaiRestClientPreferences(final TcaAppProperties tcaAppProperties) {
-        return new TcaAppPropsToAaiRestClientPrefsFunction().apply(tcaAppProperties);
-    }
-
-    @Bean
-    public RestTemplate aaiRestTemplate(final TcaAaiRestClientPreferences aaiRestClientPreferences,
-                                        final RestTemplateBuilder restTemplateBuilder) {
-        if(aaiRestClientPreferences == null) {
-            return null;
-        }
-        return restTemplateBuilder
-                .additionalCustomizers(new HttpClientPreferencesCustomizer<>(aaiRestClientPreferences))
-                .build();
-    }
-
-    @Bean
-    public TcaAaiEnrichmentService aaiEnrichmentService(final TcaAppProperties tcaAppProperties,
-                                                        final RestTemplate aaiRestTemplate) {
-        if (aaiRestTemplate == null) {
-            return null;
-        }
-        return new TcaAaiEnrichmentServiceImpl(tcaAppProperties, aaiRestTemplate);
-    }
-
-
     @Bean
     public TcaAaiEnrichmentContext tcaAaiEnrichmentContext(final TcaAppProperties tcaAppProperties,
-                                                           final TcaAaiEnrichmentService aaiEnrichmentService) {
-        return new TcaAaiEnrichmentContextImpl(tcaAppProperties, aaiEnrichmentService);
+            final RestTemplateBuilder restTemplateBuilder) {
+        return new TcaAaiEnrichmentContextImpl(tcaAppProperties, restTemplateBuilder);
     }
 
 }