Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Adding interceptors to DefaultAnnotationHandlerMapping

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
I'm converting an old web application to Spring framework and I'm using annotated controllers.
In my Spring configuration xml file, I added this definition :



copied directly from a Spring tutorial.
Now, I'm looking for a way to add an interceptor to a certain set of controllers, and not to every annotated controller, but I can't find any example or documentation explaining how to do it.

I need this interceptor to be run only for some controllers (or for some urls, which is basically the same).

I think I need to configure two different handlerMapping beans, first with interceptors and the last without, and map urls on an handler or the other.

Could anyone please share a bit of light on this subject ?

Thank you everyone.
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you use aspect, advice and pointcut to achieve the same?
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, actually I could, but I hoped there was a standard way to accomplish this task with core Spring configuration, without aspect, advice or pointcut (which I don't even know since I never used them)
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am talking about is the core AOP framework. Interceptors is just the tip of the iceberg
 
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic