Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet 3, <async-supported>true</async-supported> in web.xml vs asyncSupported=false

 
chirag visavadia
Greenhorn
Posts: 7
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml


Class definition


After deployment, whether is it Sync/Async servlet OR who will take priority web.xml or Class defination?
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a general rule, XML declarations override annotation declarations.

Three reasons for this:

1. XML declarations are more flexible. You don't have to recompile anything.

2. It's sometimes convenient to provide a bean with default properties, but still have the ability to override those properties without altering source code.

3. You might be creating more that one instance of the class object. For the most part, annotations are going to be applied to all instances created of an object. But when one of those properties varies per instance, it's not easy to make a "one-size-fits-all" annotation. So you'd use XML to override the annotations. For example, if you're defining a bean for an IoC framework where each bean instance has a discrete name, but there might be several instances of that bean.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic