private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Jetty supports the servlet specification annotations. It is not enabled by default, so the following sections show you how to enable it, and how to use them.
If you are using the jetty distribution, then annotations are enabled by default. The annotations module and its transitive dependencies are responsible for making annotation processing available.
Note that annotations that relate to JNDI, such as @Resource and @Resources are enabled via the jndi module, which is a transitive dependency on the annotations module, and thus is also enabled by default for the distribution.
To use annotations in an embedded scenario, you will need to include the jetty-annotations jar and all its dependencies onto your classpath, and you will also need to include the org.eclipse.jetty.annotations.AnnotationConfiguration into the list of Configuration classes applied to the org.eclipse.jetty.webapp.WebAppContext representing your webapp.
Here is an example application that sets up the standard test-spec.war webapp from the distribution in embedded fashion. It can be found in the jetty git repository in the examples/embedded project. Note that the test-spec.war uses not only annotations, but also JNDI, so this example also enables their processing (via the org.eclipse.jetty.plus.webapp.EnvConfiguration, org.eclipse.jetty.plus.webapp.PlusConfiguration and their related jars).
Example 12.1. ServerWithAnnotations.java