今天用若依二开,在项目里添加了一个模块,启动系统的时候报错了。
前台提示404 NOT FOUND,同时验证码无法显示。
这个问题,我一分钟之内就知道是哪儿的问题。
原因是,我启动的ruoyi-ui是Vue版本,而我的后台服务器是Cloud版本。
但是,还是想记录一下,顺便把Spring Cloud GateWay的相关知识,再巩固一遍。
08:53:21.851 [reactor-http-nio-3] ERROR c.r.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/captchaImage,异常信息:404 NOT_FOUND
08:53:55.264 [reactor-http-nio-4] ERROR c.r.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/captchaImage,异常信息:404 NOT_FOUND
可以看到,是GatewayExceptionHandler 的第52行代码提示了这个错误。
GatewayExceptionHandler.java
package com.ruoyi.gateway.handler;
import org.springframework.cloud.gateway.support.NotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
import org.spring