1、继承WebMvcConfigurationSupport实现自定义拦截器后,原先配置的时间格式返回变成时间戳,以下配置失效:

spring
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8

2、解决办法不继承WebMvcConfigurationSupport,修改为实现WebMvcConfigurer接口

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private JwtInterceptor jwtInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(jwtInterceptor)
                //拦截所有url
                .addPathPatterns("/**")
                //排除登录url
                .excludePathPatterns("/", "/login");

    }
}

3、另外还有方式就是引入fastjson替换jackson。

 

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2022-01-16
  • 2021-04-18
  • 2021-10-18
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-01
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案