This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Intercepting Jersey Resource Methods with Spring aop  RSS feed

 
Rj Ewing
Ranch Hand
Posts: 120
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use spring aop to intercept my jersey resource methods. I want to implement api versioning, where I transform the request to the latest version, do some work in the resource method, and then transform the response to the requested api version.

I am using spring and jersey currently. I tried to use spring aop to intercept the jersey resource methods, and at first glance it appeared to be working. However, I noticed 1 problem.

Anything injected into the RootResource class via jersey (Ex. @Context HttpHeaders) is null when using spring aop. It is null both in the advice method as well as the resource method. When I disable aop, the properties are injected properly and accessable in the resource method.

Any ideas on what is happening and how to fix it?





 
Rj Ewing
Ranch Hand
Posts: 120
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so it looks like this is a bug in jersey-spring3. https://java.net/jira/browse/JERSEY-3126?jql=text%20~%20%22spring%20aop%22
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!