how to intercept JSF managed bean method

Splash Forums Rewrite Users how to intercept JSF managed bean method


This topic contains 4 replies, has 2 voices, and was last updated by  xuzhike 10 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #18099


    Hi, All,

    I want to log JSF managed bean “Action” method execution time. how do I implement the interceptor?

    I referenced SocialPM’s ResponseTimeLoggingFilter, but it seems not meet my requirement completelly.

    please advise.

    thx a lot


    This depends on the frameworks that you use. If you are using CDI you could use a standard interceptor for this job. With Spring you could use the AOP module for something similar.

    You could also implement a JSF PhaseListener and use it to log the execution time of individual JSF phases. That’s what I always do to get a general impression on the overall performance behavior of my application.



    Hi, Christian,

    Thanks for your idea.

    my application bases on JSF2+Spring3. I tried to integrate CDI with Spring/JSF.

    but seems it not work to inject Spring’s Service into JSF Managed Bean ( I want to use CDI in JSF Bean, Spring’s annotation in Service/Dao).

    if use Spring AOP module, seems JSF managed bean should be managed by Spring.


    In a typical application setup you will probably use either CDI or Spring and no JSF managed beans at all. Is there any reason you are using JSF managed beans for the view and Spring for the Dao/Services? Why not use Spring for everything? See:

    Than you could measure the execution time for methods executed more or less easily using Spring AOP.



    you are right. I should use Spring to manage everything.

    I just tried to integrate everything to see if it works.


Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.