栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Spring云配置模式匹配配置文件

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Spring云配置模式匹配配置文件

在对PatternMatching源代码进行一些调试之后,这是我解决该问题的方法:您可以选择以下两种方法之一。

application.ymlserver:  port: 8888spring:  cloud:    config:      server:        git:          uri: ssh://xxxx@github/sample/cloud-config-properties.git          repos:development: pattern: '*/development' ## give in quotes uri: ssh://git@xxxgithub.com/development.git

要么

development:  pattern: xx*/development,*/development ##since it is not allowed to have a value starting with a wildcard( '*' )after pattern I first gave a generic matching but the second value is */development. Since pattern takes multiple values, the second pattern will match with the profile  uri: ssh://git@xxxgithub.com/development.git

模式:* / development。yml文件错误-预期为字母或数字字符,但找到但找到了/。

无法识别概要文件模式git
repo的原因是:尽管spring允许yml文件中以’-‘开头的模式有多个数组值,但是模式匹配器将’-‘作为要匹配的字符串。即它正在寻找一种模式,

'-*/development'
而不是
'*/development'

   repos:    development:     pattern:      -*/development          -*/staging

我观察到的另一个问题是,如果我不得不将模式数组提到为yml文件,则会在yml文件上出现编译错误

'-*/development'
-在连字符后注意空格(这表示它可以将多个值作为数组保存)并以’*开头/
development”,并显示错误:预期的字母或数字字符,但找到但找到了/

 repos:        development:         pattern:          - */development   - */staging


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/421786.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号