I\'m working through the Java EE servlet tutorial and tried the mood example. I noticed the doFilter is getting called twice, once the servlet call is in the chain and the secon
As Mohan has stated, @Component will make your filter be called twice if you have it already registered in you Application class, like this:
resources.add(new MyFilter());
If that's the case you have to choose between annotating it or registering it. But this is only valid for JAX-RS applications that use Spring. Not the topic of this question.