一、解析yaml報(bào)錯(cuò)

報(bào)錯(cuò)信息:文章來源:http://www.zghlxwxcb.cn/news/detail-533359.html
Application run failed org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character '@' that cannot start any token. (Do not use @ for indentation) in 'reader', line 58, column 13: active: @profiles.active@ 文章來源地址http://www.zghlxwxcb.cn/news/detail-533359.html
二、原因
一、需要引入
<profiles>
<profile>
<id>dev</id>
<properties>
<!-- 環(huán)境標(biāo)識(shí),需要與配置文件的名稱相對(duì)應(yīng) -->
<profiles.active>dev</profiles.active>
</properties>
<activation>
<!-- 默認(rèn)環(huán)境 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<!-- 環(huán)境標(biāo)識(shí),需要與配置文件的名稱相對(duì)應(yīng) -->
<profiles.active>test</profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
</profile>
</profiles>
二、需要開啟 resource 過濾,才能進(jìn)行占位符使用
<build>
? ? .......
? ? ? ? <resources>
<resource>
<directory>src/main/resources</directory>
<!-- 關(guān)閉過濾 -->
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<!-- 引入所有 匹配文件進(jìn)行過濾 -->
<includes>
<include>application*</include>
<include>bootstrap*</include>
<include>banner*</include>
</includes>
<!-- 啟用過濾 即該資源中的變量將會(huì)被過濾器中的值替換 -->
<filtering>true</filtering>
</resource>
</resources>
</build>
到了這里,關(guān)于org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@‘的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!