Results 1 to 5 of 5

Thread: Spring aop interceptor

  1. #1
    Join Date
    Jul 2011
    Posts
    5

    Default Spring aop interceptor

    Hello,
    I build a Spring mvc application.
    I want to intercept the call to some controllers on this application.
    the problem facing me is that i can't intercept these controllers in the traditionnal way:

    ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:./config/my-config.xml");
    Object simpleInterface = (Object) applicationContext.getBean(NameBean);


    since the spring dispatcher call directely the appropriate controller. (the initialisation of the controller objects is implicite).

    is there a why to intercept the call to these controller?

    Thank you in advance.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    And why wouldn't that be possible?! Spring does exactly the same as you show in your snippet.. I really suggest you read the aop chapter of the reference guide.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2011
    Posts
    5

    Default

    i already read the aop chapter,
    the problem in my case is that as you know the dispatcher call the controller.
    there is no need to write the code shown in my snippet to call the controller.
    and since i didn't call the controller using such code i can't activated the aop interceptor.
    and that's is my problem.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    You are making problems where there are none.. As I stated spring does exactly THAT for you.. So yes you don't call the controller yourself SPRING calls the controller/object/whatever in the EXACTLY THE SAME WAY...

    So yes you can activate and use aop in that way.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jul 2011
    Posts
    5

    Default

    Thank you for your response, i will check again!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •