当前位置: 代码网 > it编程>编程语言>Java > 解决SpringCloud gateway网关配置MVC拦截器报错问题

解决SpringCloud gateway网关配置MVC拦截器报错问题

2025年06月23日 Java 我要评论
springcloud gateway网关配置mvc拦截器报错报错问题org.springframework.beans.factory.beandefinitionstoreexception: f

springcloud gateway网关配置mvc拦截器报错

报错问题

org.springframework.beans.factory.beandefinitionstoreexception: failed to process import candidates for configuration class [com.hmall.gateway.gatewayapplication]; nested exception is java.io.filenotfoundexception: class path resource [org/springframework/web/servlet/config/annotation/webmvcconfigurer.class] cannot be opened because it does not exist

在spring.factories配置自动装配配置类

问题原因

因为网关没有引入springmvc,直接不会成效,会报错,写这个注解,有springmvc时候才生效

解决方案

在mvc配置类加上“@conditionalonclass(dispatcherservlet.class)”主页,表示使用mvc才加载这个配置

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com