Hello. I’m new to spring and to the Axon framework and I’m trying to wire up a small test project.
I’m getting a java.lang.IllegalStateException: Cannot request current Scope if none is active
My aggregate looks like this:
`
@Aggregate
class Film {
@AggregateIdentifier
lateinit var id: String
lateinit var name: String
@EventHandler
fun on(event: FilmCreatedEvent) {
this.id = event.id
this.name = event.name
}
}
`
and my command handler like this:
`
@Component
class FilmCommandHandler (
private val filmRepository: FilmRepository
) {
@CommandHandler
fun on(command: CreateFilmCommand) {
Assert.hasLength(command.id, “id missing”)
Assert.hasLength(command.name, “missing name”)
val event = FilmCreatedEvent(command.id, command.name)
AggregateLifecycle.appy(event) // ERROR
}
}
`
Can anyone point me in the right direction?