mirror of https://github.com/usbharu/Hideout.git
feat: Subscriberにinit関数を追加
This commit is contained in:
parent
f9c10eeb7a
commit
d5805089f5
|
@ -1,3 +1,5 @@
|
||||||
package dev.usbharu.hideout.core.application.domainevent.subscribers
|
package dev.usbharu.hideout.core.application.domainevent.subscribers
|
||||||
|
|
||||||
interface Subscriber
|
interface Subscriber {
|
||||||
|
fun init()
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ import org.springframework.boot.ApplicationRunner
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
class SubscriberRunner(subscribers: List<Subscriber>) : ApplicationRunner {
|
class SubscriberRunner(private val subscribers: List<Subscriber>) : ApplicationRunner {
|
||||||
override fun run(args: ApplicationArguments?) {
|
override fun run(args: ApplicationArguments?) {
|
||||||
|
subscribers.forEach { it.init() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue