Only load SchemaService related beans in aai-common when schema.translator.list=schem...
[aai/aai-common.git] / aai-schema-ingest / src / main / java / org / onap / aai / config / SchemaServiceConfiguration.java
index 81ef02a..701fd17 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.config;
 
-import org.onap.aai.setup.SchemaServiceTranslator;
-import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersionsBean;
-import org.onap.aai.setup.Translator;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
+import org.onap.aai.setup.*;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.PropertySource;
 
 @Configuration
-@ConditionalOnExpression("'${schema.translator.list}'.contains('schema-service')")
+@ConditionalOnProperty(name = "schema.translator.list", havingValue = "schema-service", matchIfMissing = false)
 @PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
 @PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
 public class SchemaServiceConfiguration {
@@ -41,14 +39,19 @@ public class SchemaServiceConfiguration {
         return new SchemaVersionsBean();
     }
 
+    @Bean(name = "schemaServiceVersions")
+    public SchemaServiceVersions schemaServiceVersions() {
+        return schemaVersionsBean().getSchemaVersions();
+    }
+
     @Bean(name = "schemaVersions")
     public SchemaVersions schemaVersions() {
-        return schemaVersionsBean().getSchemaVersions();
+        return schemaServiceVersions();
     }
 
     @Bean(name = "schemaServiceTranslator")
     public Translator schemaServiceTranslator() {
-        return new SchemaServiceTranslator(schemaVersions());
+        return new SchemaServiceTranslator(schemaServiceVersions());
     }
 
 }