I use similar approach for commands in couple of p...
# spring
c
I use similar approach for commands in couple of projects at work:
Copy code
private lateinit var STATIC_COMMAND_SERVICE: CommandService

interface Command<T> : Serializable {
	fun execute(): T {
		return STATIC_COMMAND_SERVICE.execute(this)
	}
}

@Configuration
internal class CommandServiceInitializer(commandService: CommandService) {
	init {
		STATIC_COMMAND_SERVICE = commandService
	}
}