Spring HandlerInterceptor mapping with annotations

前端 未结 2 1414
旧巷少年郎
旧巷少年郎 2021-02-14 22:00

Good day. I got a spring mvc application and 2 controllers inside. First controller (PublicController) can process requests from all users, Second (PrivateController) can only

2条回答
  •  無奈伤痛
    2021-02-14 22:35

    I don't know why, when I use your way, it worked. But the interceptor executed twice. And I found another way to do this.

        @Bean
        public MappedInterceptor interceptor() {
            return new MappedInterceptor(null, new String[]{"/","/**/*.js", "/**/*.html", "/**/*.css"}, new LogInterceptor());
        }
    

提交回复
热议问题