Merge "Resource resolution should return a string"
[ccsdk/cds.git] / ms / controllerblueprints / modules / blueprint-core / src / main / kotlin / org / onap / ccsdk / cds / controllerblueprints / core / service / BluePrintDependencyService.kt
index fdaf25c..776e041 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
 
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.springframework.context.ApplicationContext
+import kotlin.reflect.KClass
 
 /**
  * Generic Bluepring Dependency Service, which will be used mainly in scripts.
@@ -44,4 +45,9 @@ object BluePrintDependencyService {
         return applicationContext.getBean(type)
                 ?: throw BluePrintProcessorException("failed to get instance($type)")
     }
+
+    inline fun <reified T> instance(type: KClass<*>): T {
+        return applicationContext.getBean(type.java) as? T
+                ?: throw BluePrintProcessorException("failed to get instance($type)")
+    }
 }
\ No newline at end of file