我想在application.yml文件中配置ZUUL属性但不知何故我无法在yml文件中定义路由(我在浏览器中找不到页面)。它虽然在application.properties文件中完美运行。以下是application.properties
和application.yml
文件中的属性。
application.properties
#subway is the application context name of a microservice. This works perfectly fine.
zuul.routes.**subway**.url=http://localhost:7777/
applcation.yml文件
zuul:
routes:
subway:
path: /subway/**
url: http://localhost:7777/
也试过:
zuul:
routes:
service-id: /subway/**
path: /subway/**
url: "http://localhost:7777/"
strip-prefix: false
service-id: /subway1/**
path: /subway1/**
strip-prefix: false
url: "http://localhost:6666/"
service-id: /subway2/**
path: /subway2/**
url: "http://localhost:5555/"
strip-prefix: false
我得到例外
引起:org.yaml.snakeyaml.parser.ParserException:解析'reader'中的MappingNode,第12行,第7列:service-id:/ subway / **
有什么我错过了吗?
以下是它应该如何工作。谢谢@harshavmb和@pvpkiran:
zuul:
routes:
subway:
service-id: /subway/**
path: /subway/**
url: "http://localhost:7777/"
strip-prefix: false
subway1:
service-id: /subway1/**
path: /subway1/**
strip-prefix: false
url: "http://localhost:6666/"
subway2:
service-id: /subway2/**
path: /subway2/**
url: "http://localhost:5555/"
strip-prefix: false