Package org.apache.tapestry5.ioc.annotations

# Annotation Type Optional

@Target(METHOD) @Retention(RUNTIME) @Documented @UseWith(MODULE) public @interface Optional
Marks a service contribution method within a module as being optional: it is not an error if the contribution does not match against an actual service. In that case, the method will simply never be invoked. This is occasionally useful when a module is designed to work with another module if the second module is present. Without optional contributions, you would see hard errors when registry is created, and have to create a layer cake of small modules to prevent such errors.

Since:
  5.3
See Also:
  - `Contribute`
  - `ContributionDef3.isOptional()`