Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) 2010-2011. Axon Framework
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.axonframework.commandhandling.annotation;
Marker annotation to mark any method on an object as being a CommandHandler. Use the AnnotationCommandHandlerAdapter to subscribe the annotated class to the command bus.

Alternatively, the annotations may be placed on an AggregateRoot, in which case the AggregateAnnotationCommandHandler can be used to subscribe the handlers to the command bus. When the annotation appears on an Aggregate's constructor, that command will cause a new aggregate to be created and stored in the repository provided with the AggregateAnnotationCommandHandler.

The annotated method's first parameter is the command handled by that method. Optionally, the command handler may specify a second parameter of type org.axonframework.unitofwork.UnitOfWork. The active Unit of Work will be passed if that parameter is supplied.

Allard Buijze
public @interface CommandHandler {
New to GrepCode? Check out our FAQ X