springboot的启动类xxxApplication不能扫描到拦截器配置类,可加上@ComponentScan(basePackages={"com.maya.common"}),即可解决。其中com.maya.common 为拦截器的注解配置类所在的路径。

话不多说,直接上图。

springboot中配置了拦截器后,拦截器无效的解决方案之一

springboot中配置了拦截器后,拦截器无效的解决方案之一

 

springboot中配置了拦截器后,拦截器无效的解决方案之一

 

如果访问出现404

将@ComponentScan(basePackages={"com.maya.common"})改为@ComponentScan(basePackages={"com.maya"}),即改为最外面一层包的路径,具体路径根据自己项目来更改。

相关文章:

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