One is for applying your interceptor to a particular bean using dd.You are applying myInterceptor to interceptorfoo method on bean FooBean.The other one is to inject dependencies into interceptor class itself.
1. In the first style of dd, you dont have an option to specify any resource references (or, dependency injection). 2. Second style allows to specify that in the dd itself. The following example will support the point:
This thread might be dead for years. But I am currently preparing myself for the SCBCD 5 exam and I was confused by Jaaps question, too.
So here are my 5 cents to this.
The first deployment descriptor snippet of Jaaps initial question applies the interceptor class "MyInterceptor" to the method with the signature "interceptFoo(String)" of the bean named "FooBean". The corresponding metadata annotation could look like this:
The method name "interceptFoo" is a little bit misleading in this example. It might have be named "anyMethod" because it is the method which is to be intercepted. And, there is a enclosing "method" element missing in the snippet. It is expected to embrace the elements "method-name" and "method-params".
The secondond deployment descriptor snippet declares the method named "interceptFoo" of the class "MyInterceptor" to be an around-invoke interception method. The "method-params" element is not legal in this context since any around-invoke interception method is expected to have the signature "Object <any-method-name>(InvocationContext) throws Exception".
The corresponding metadata annotation might look like this:
I hope this of help to somebody.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop