feat: Subscriberにinit関数を追加

This commit is contained in:
usbharu 2024-08-24 10:53:44 +09:00
parent f9c10eeb7a
commit d5805089f5
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,5 @@
package dev.usbharu.hideout.core.application.domainevent.subscribers
interface Subscriber
interface Subscriber {
fun init()
}

View File

@ -5,7 +5,8 @@ import org.springframework.boot.ApplicationRunner
import org.springframework.stereotype.Component
@Component
class SubscriberRunner(subscribers: List<Subscriber>) : ApplicationRunner {
class SubscriberRunner(private val subscribers: List<Subscriber>) : ApplicationRunner {
override fun run(args: ApplicationArguments?) {
subscribers.forEach { it.init() }
}
}