Annotations

Constructor annotations for configuration and dependency injection

Pixie supports constructor injection. Each parameter of the constructor Pixie will use must be annotated with one of the following annotations.

All annotations are in the org.tomitribe.pixie package.

AnnotationPurposeExample
@ParamMaps a constructor parameter to a config property@Param("username") String username
@DefaultProvides a default value if the property is missing@Param("country") @Default("USA") String country
@ComponentInjects a dependent object built by or given to the Pixie System@Component PaymentProcessor processor
@NullableAllows a property to be null if missing@Nullable @Param("footer") String footer
@NameInjects the component’s name from the config@Name String serviceName
@EventInjects a Consumer<T> to fire events@Event Consumer<OrderPlaced> event
@ObservesMarks a method as an event listenervoid onEvent(@Observes OrderPlaced event)