Package io.mats3.spring
Annotation Interface MatsEndpointSetup
@Documented
@Retention(RUNTIME)
@Target({METHOD,ANNOTATION_TYPE})
@Repeatable(MatsEndpointSetups.class)
public @interface MatsEndpointSetup
A method annotated with this repeatable annotation specifies a method that shall set up a (usually)
Multi-Staged Mats Endpoint. Note that as opposed to
@MatsMapping
, this method will be invoked
once to set up the endpoint, and will not be invoked each time when the Mats endpoint is invoked (as
is the case with @MatsMapping). You might want to check up on the MatsClassMapping
instead.
You specify the EndpointId, state STO type and the reply DTO type using annotation parameters. The method is then
invoked with a MatsEndpoint
instance as argument, and the method should then invoke
endpoint.stage(..)
and
endpoint.lastStage(..)
to set up the MatsEndpoint. You can
also have an argument of type MatsEndpoint.EndpointConfig
to be able to configure the endpoint. Remember again that this
is a setup method where you should set up the endpoint, and it is invoked only once during startup, and
then never again.
In a multi-MatsFactory setup, you may qualify which MatsFactory this Endpoint should be constructed on - read JavaDoc
on @MatsMapping
for how this works.- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe Mats Endpoint Id that this endpoint should listen to.Specified theMatsFactory
to use by means of specifying the bean name of theMatsFactory
.Class<? extends Annotation>
Specifies theMatsFactory
to use by means of a specific qualifier annotation type (which thus must be meta-annotated withQualifier
).Specified theMatsFactory
to use by means of specifying the@Qualifier
value.Class<?>
The Mats Data Transfer Object class that will be returned by the last stage of the staged endpoint.Class<?>
The Mats State Transfer Object class that should be employed for all of the stages for this endpoint.Alias for "endpointId", so that if you only need to set the endpointId, you can do so directly:@MatsEndpointSetup("endpointId")
-
Element Details
-
endpointId
The Mats Endpoint Id that this endpoint should listen to.- Returns:
- the Mats Endpoint Id which this endpoint listens to.
- Default:
- ""
-
value
Alias for "endpointId", so that if you only need to set the endpointId, you can do so directly:@MatsEndpointSetup("endpointId")
- Returns:
- the endpointId.
- Default:
- ""
-
state
Class<?> stateThe Mats State Transfer Object class that should be employed for all of the stages for this endpoint.- Returns:
- the State Transfer Object class that should be employed for all of the stages for this endpoint.
- Default:
- void.class
-
reply
Class<?> replyThe Mats Data Transfer Object class that will be returned by the last stage of the staged endpoint.- Returns:
- the Data Transfer Object class that will be returned by the last stage of the staged endpoint.
- Default:
- void.class
-
matsFactoryCustomQualifierType
Class<? extends Annotation> matsFactoryCustomQualifierTypeSpecifies theMatsFactory
to use by means of a specific qualifier annotation type (which thus must be meta-annotated withQualifier
). Notice that this will search for the custom qualifier annotation type, as opposed to if you add the annotation to the @MatsEndpointSetup-annotated method directly, in which case it "equals" the annotation instance (as Spring also does when performing injection with such qualifiers). The difference comes into play if the annotation has values, where e.g. a@SpecialMatsFactory(location="central")
is not equal to@SpecialMatsFactory(location="region_west")
- but they are equal when comparing types, as the qualification here does. Thus, if using this qualifier-approach, you should probably not use values on your custom qualifier annotations (instead make separate custom qualifier annotations, e.g.@MatsFactoryCentral
and@MatsFactoryRegionWest
for the example).- Returns:
- the custom qualifier type which the wanted
MatsFactory
is qualified with.
- Default:
- java.lang.annotation.Annotation.class
-
matsFactoryQualifierValue
String matsFactoryQualifierValueSpecified theMatsFactory
to use by means of specifying the@Qualifier
value. Spring performs such lookup by first looking for actual qualifiers with the specified value, e.g.@Qualifier(value="the_value")
. If this does not produce a result, it will try to find a bean with this value as the bean name.- Returns:
- the qualifier value which the wanted
MatsFactory
is qualified with.
- Default:
- ""
-
matsFactoryBeanName
String matsFactoryBeanNameSpecified theMatsFactory
to use by means of specifying the bean name of theMatsFactory
.- Returns:
- the bean name of the wanted
MatsFactory
.
- Default:
- ""
-