Announcement Announcement Module
No announcement yet.
Spring aop interceptor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring aop interceptor

    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
    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.


    • #3
      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
        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.


        • #5
          Thank you for your response, i will check again!