• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the important notes on p.118 of Ivan's notes

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p.118 of Ivan's notes, the important notes :

When there are multiple interceptors of the same kind, for instance for post-construct life cycle events, a interceptor chain is built and the first interceptor method in the chain is invoked by the container.

But what I observe is all post-construct interceptors are called, not only the first interceptor method:


Output on the console:

LogInterceptor - constructor
Info: MyDefaultInterceptor.postContruct
Info: LogInterceptor.postContruct
Info: MyAroundInvokeInterceptor.postContruct
Info: *** SingletonSessionBeanA - initialized


MyAroundInvokeInterceptor is the second interceptor in the chain, but it is still invoked to intercept the @PostConstruct method in the SingletonBeanA.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what I observe is all post-construct interceptors are called, not only the first interceptor method

That is correct, and that is what he says in the next paragraph:
If an interceptor method takes an InvocationContext object parameter, then the proceed() method must be invoked in this object, in order for the other interceptors in the chain to be invoked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic