Intercepting Jersey Resource Methods with Spring aop
posted 4 months ago
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.