thake a look at this simple pice of code
data class Cmd(val id:UUID)
@Component
class MyComponent
@Aggregate
class MyAggr(){
@AggregateIdentifier
final var id: UUID = UUID.randomUUID()
@CommandHandler
constructor(cmd:Cmd,
myComponent: MyComponent
):this(){
}
}
@Configuration
class MyConfig {
@Bean
fun createRepository(eventStore: EventStore?): Repository<MyAggr>? {
val ret = EventSourcingRepository.builder(
MyAggr::class.java
).eventStore(eventStore).build<EventSourcingRepository<MyAggr>>()
return ret
}
}
during the start up of application i get this error
Caused by: org.axonframework.messaging.annotation.UnsupportedHandlerException: Unable to resolve parameter 1 (MyComponent) in handler public rsobies.psd.common.MyAggr(rsobies.psd.common.Cmd,rsobies.psd.common.MyComponent).
the app runs without an error when i remove second argument from command handler constructor OR when I remove @Bean annotation from “createRepository” method so the bean will not be created
hmm, what am i doing wrong? how to correctly create aggregate repository to be able to inject it into another class?