36

I am trying to follow a Servlet 3.0 tutorial which refers to @WebServletContextListener. However, I cannot find such an annotation in my javaee-web-api-6.0.jar dependency (I am using maven).

So, where is @WebServletContextListener?

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453

1 Answers1

49

The annotation is called @WebListener. And you still have to implement ServletContextListener.

informatik01
  • 16,038
  • 10
  • 74
  • 104
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • I was just doing more reading and came to the same conclusion. Thanks. – Jérôme Verstrynge Sep 28 '11 at 11:57
  • 2
    Actually `@WebServletContextListener` is mentioned on the official Oracle's tutorials, written by [Shing Wai Chan](https://blogs.oracle.com/swchan/entry/servlet_3_0_annotations)(Author of JSR specifications) – another Sep 20 '16 at 10:09