如何GET在用REST编写的服务上自动记录任何传入的url 请求Spring?
@RestController
public class MyRest {
@RequestMapping(method = RequestMethod.GET,
produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public ComplexRsp test() {
//...
}
}
Run Code Online (Sandbox Code Playgroud)
我已经使用了cxffor soap,其中日志记录就像使用@InInterceptors, @OutInterceptors.
春天有什么类似的休息吗?
我正在研究Spring Framework,我想编写一个拦截器,最后我写了它并且工作正常.但在某一点上,我不希望我的拦截器拦截用户想要注销并且会话失效的请求.但它并没有按照我的期望发生.
我通过扩展WebMvcConfigurerAdapter并使用addInterceptors方法添加拦截器,这里是代码.
public void addInterceptors(InterceptorRegistry registry) {
super.addInterceptors(registry);
registry.addInterceptor( loggerInterceptor );
registry.addInterceptor( authenticationInterceptor ).excludePathPatterns("/invalidate");
}
Run Code Online (Sandbox Code Playgroud)
我在这里做错了吗?excludePathPatterns - >我的URL以/ invalidate结尾.所以请指导我,如何设置一个合适的模式.