Avisi Blog

servlet api 3.0 classpath scanning

Geschreven door Gert-Jan van de Streek | 05 March 2012

When upgrading to servlet api 3.0 be aware of the performance penalty you get from the classpath scanning that looks for annotations denoting servlets, filters, etc.

For a mid-sized app this can be 10 seconds before you know it, slowing down your development roundtrip for the occasional restart you need. If you want, you can disable the classpath scanning by the metadata-complete="true" property in the web.xml file. Of course now you can't use annotations any more.

 

When you are using Jetty though, this property doesn't help. As far as I understand from this post, you can add configurationDiscovered=false property to the webapp config:

 

<webAppConfig>
<contextPath>/langur</contextPath>
<configurationDiscovered>false</configurationDiscovered>
<extraClasspath>${basedir}/src/main/resources </extraClasspath>
</webAppConfig>

But I haven't had any luck with it. If you have, drop me a note.