I have written a CustomValidationInterceptor. I want to configure this interceptor at service level with the use of annotations. Suppose, If I have exposed 5 services, and I want to configure the Interceptor for Only 1 of those service then how shall I do that
Following is my current code which is not firing the interceptor
@Service("someService")
@Path("somePath")
@InInterceptors(interceptors = { "com.telus.ffo.msl.service.impl.CustomValidationInterceptor" })
public class SystemCheckRestService {
@POST
@Path("/{phoneNumber}")
@Produces({"application/json;charset=UTF-8"})
public Response preRepairTest(@PathParam("phoneNumber") String phoneNumber) {
// Code...
}
}
Code snippet of My custom Interceptor is :
@Component
public class CustomValidationInterceptor extends AbstractPhaseInterceptor<Message>{
public CustomValidationInterceptor() {
super(Phase.PRE_INVOKE); // Put this interceptor in this phase
}
public void handleMessage(Message message) {
// some code
}
}