zuul No route found for uri:
来源:互联网 发布:java中poi是什么意思 编辑:程序博客网 时间:2024/06/05 16:27
一个web项目连接zuul网关连接后台多个服务。
示例:web端使用feignClient
package com.mark.demo.security.service;import java.util.List;import org.springframework.beans.factory.annotation.Value;import org.springframework.cloud.netflix.feign.FeignClient;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import com.mark.demo.security.base.PaginateResult;import com.mark.demo.security.entity.Menu;import com.mark.demo.security.service.hystrix.MenuFeignFallBackFactory;import com.mark.demo.security.service.hystrix.MenuFeignServiceHystrix;/**hxp(hxpwangyi@126.com)*2017年9月7日**/@FeignClient(name="menu",url="http://localhost:9999/service/menu",fallbackFactory=MenuFeignFallBackFactory.class)@RequestMapping("/service/menu")public interface MenuFeignService {@RequestMapping("/getMenuTopLever")List<Menu> getMenuTopLever();@RequestMapping("/getMenuChildren")List<Menu> getMenuChildren(@RequestParam("pid")int pid);@RequestMapping("/updateMenu")boolean updateMenu(@RequestBody Menu menu);@RequestMapping(value="/list/data",method=RequestMethod.POST)PaginateResult<Menu> listData(@RequestParam("menu") Menu menu,@RequestParam("pageSize")int pageSize,@RequestParam("currentPage")int currentPage);}
zuul配置:
zuul.strip-prefix=truezuul.routes.menu.path=/service/menu/**zuul.routes.menu.service-id=menuService2zuul.routes.resource.path=/service/resource**zuul.routes.resource.service-id=resourceServicezuul.routes.user.path=/zuul/user/**zuul.routes.user.service-id=userServicezuul.routes.commonRedis.path=/service/redis/common/**zuul.routes.commonRedis.service-id=redisService
调试时发现404错误:日志打印zuul No route found for uri:
跟踪代码发现/zuul的默认context-path是/zuul,它会裁剪请求的url
加上一个配置
zuul.servlet-path=/
就可以调通了
阅读全文
0 0
- zuul No route found for uri:
- symfony 2 No route found for “GET /” 的解决方法
- STS error: No mapping found for HTTP request with URI
- Spring MVC No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI
- no mapping found for http request with uri
- spring No mapping found for HTTP request with URI
- mark springmvc [No mapping found for HTTP request with URI]
- 不一样的No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI
- springMVC No mapping found for HTTP request with URI
- WARNING: No mapping found for HTTP request with URI
- No mapping found for HTTP request with URI问题
- springMVC No mapping found for HTTP request with URI
- 软考错题合集之15-11-AM
- 多线程-从Future对象中获取线程处理Callable方法的结果
- java基础小知识(二)——LAB1问答题
- c语言题(1)
- 登录注册+接口
- zuul No route found for uri:
- 认识Linux数据重定向redirection
- 安卓蓝牙bluetooth开发全解
- 51nod 1089 最长回文子串 V2(Manacher算法)
- 动态代理模式和责任链模式
- 53. Maximum Subarray
- LeetCode刷题(14)
- 心得,在工作中学会”忽悠”别人
- 网狐棋牌 消息命令