Handlers
Handlers are registered in the application model. The platform runs the method which is annotated with @Execute
. Only one method should be annotated with @Execute
.
The run method should not be annotated with @Inject
because on every action which requires Inject all methods annotated with @Inject
will be executed, even the run method if it is annotated with @Inject
.
Field Injection
Handlers should not use field injection (@Inject
on fields) because handlers are created as singletons very early in the application lifecycle and fields cannot be reinjected., see http://wiki.eclipse.org/Eclipse4/RCP/FAQ#Why_aren.27t_my_handler_fields_being_re-injected.3F
But it is safe to use method injection on the execution method of the handler.