Annotation Interface InjectEntity
Annotation to be placed on a parameter of a
MessageHandler annotated method that should receive an entity
loaded from the StateManager.
The parameter should be of the type of the entity to inject, or of a
ManagedEntity with the generic of the entity to inject.
The idProperty attribute can be used to specify the property of the message payload that contains the
identifier of the entity to inject. If not specified, the idResolver is used to resolve the identifier of the
entity to inject.
Unless a specific idResolver is specified, the AnnotationBasedEntityIdResolver is used to resolve the
entity id from the message. This is based on finding a TargetEntityId annotation on a field or accessor
method of the message payload.
So, identifiers will be resolved in the following order:
- From the property specified in
idProperty. - From the
idResolver. - From the
TargetEntityIdannotation on the message payload.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe property of the message payload that contains the identifier of the entity to inject.Class<? extends EntityIdResolver> TheEntityIdResolverto resolve the identifier of the entity to inject.
-
Element Details
-
idProperty
String idPropertyThe property of the message payload that contains the identifier of the entity to inject. If not specified, theidResolveris used to resolve the identifier of the entity to inject.- Returns:
- The property of the message payload that contains the identifier of the entity to inject.
- Default:
""
-
idResolver
Class<? extends EntityIdResolver> idResolverTheEntityIdResolverto resolve the identifier of the entity to inject. Should have a no-arg constructor.- Returns:
- The
EntityIdResolverto resolve the identifier of the entity to inject.
- Default:
org.axonframework.modelling.annotation.AnnotationBasedEntityIdResolver.class
-