@@ -21,6 +21,7 @@ package de.fhg.aisec.ids.rm
21
21
22
22
import org.slf4j.Logger
23
23
import org.slf4j.LoggerFactory
24
+ import org.springframework.beans.BeansException
24
25
import org.springframework.boot.context.event.ApplicationReadyEvent
25
26
import org.springframework.context.ApplicationContext
26
27
import org.springframework.context.ApplicationContextAware
@@ -44,8 +45,6 @@ class XmlDeployWatcher : ApplicationContextAware {
44
45
this .applicationContext = applicationContext
45
46
}
46
47
47
- private val xmlContexts = mutableMapOf<String , CompletableFuture <AbstractXmlApplicationContext >>()
48
-
49
48
private fun startXmlApplicationContext (xmlPath : String ) {
50
49
LOG .info(" XML file {} detected, creating XmlApplicationContext..." , xmlPath)
51
50
val xmlContextFuture: CompletableFuture <AbstractXmlApplicationContext > = CompletableFuture .supplyAsync {
@@ -150,6 +149,20 @@ class XmlDeployWatcher : ApplicationContextAware {
150
149
}
151
150
152
151
companion object {
153
- val LOG : Logger = LoggerFactory .getLogger(XmlDeployWatcher ::class .java)
152
+ private val LOG : Logger = LoggerFactory .getLogger(XmlDeployWatcher ::class .java)
153
+ private val xmlContexts = mutableMapOf<String , CompletableFuture <AbstractXmlApplicationContext >>()
154
+
155
+ @Throws(BeansException ::class )
156
+ fun <T > getBeansOfType (type : Class <T >? ): List <T > {
157
+ return xmlContexts.values
158
+ .mapNotNull {
159
+ if (it.isDone) {
160
+ it.get()
161
+ } else {
162
+ null
163
+ }
164
+ }
165
+ .flatMap { it.getBeansOfType(type).values }
166
+ }
154
167
}
155
168
}
0 commit comments