首先看注册类中是否有@EnableMvc如果有就删除
这样写就行了
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Resource
private SessionInterceptor sessionInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {