Differences

This shows you the differences between two versions of the page.

Link to this comparison view

handlers [2014/01/16 10:11]
handlers [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== 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
 +
 +<note tip>But it is safe to use method injection on the execution method of the handler.</note>
 +
 +{{tag>e4}}