Only load SchemaService related beans in aai-common when schema.translator.list=schem...
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / config / IntrospectionConfig.java
index aa4ec1a..2a4673c 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.config;
 
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.MoxyLoader;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
 
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.introspection.MoxyLoader;
-import org.onap.aai.nodes.NodeIngestor;
-
+@Import({ConfigConfiguration.class, SchemaServiceConfiguration.class, NodesConfiguration.class,
+        EdgesConfiguration.class})
 @Configuration
+
 public class IntrospectionConfig {
 
     private Map<SchemaVersion, MoxyLoader> moxyInstanceMap = new ConcurrentHashMap<>();
+
     @Autowired
-    NodeIngestor nodeIngestor;
+    NodesConfiguration nodesConfiguration;
 
     @Bean
     public LoaderFactory loaderFactory(SchemaVersions schemaVersions) {
@@ -48,9 +52,9 @@ public class IntrospectionConfig {
 
     @Bean
     public Map<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) {
-        for(SchemaVersion version : schemaVersions.getVersions()){
+        for (SchemaVersion version : schemaVersions.getVersions()) {
             if (!moxyInstanceMap.containsKey(version)) {
-                moxyInstanceMap.put(version, new MoxyLoader(version, nodeIngestor));
+                moxyInstanceMap.put(version, new MoxyLoader(version, nodesConfiguration.nodeIngestor()));
             }
         }
         return moxyInstanceMap;