I'm trying to implement a command-query design pattern into a MVC spring based application.
I have, for example, some decorated commands using decorator pattern like bellow:
ICommandHandler handler =
new DeadlockRetryCommandHandlerDecorator<MoveCustomerCommand>(
new TransactionCommandHandlerDecorator<MoveCustomerCommand>(
new MoveCustomerCommandHandler(
new EntityFrameworkUnitOfWork(connectionString),
// Inject other dependencies for the handler here
)
)
);
How can I inject such a handler into a controller constructor? Where should I instantiate this handler? A place where this can be instantiated can be the controller constructor, but this isn't the best solution. Any other ideeas?
Thanks