yml配置文件中使用@符号解析失败
本来是准备在bootstrap.yml中引入pom.xml文件中的配置
这是bootstrap.yml文件
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-YWsmP8nk-1587017893106)(C:\Users\Administrator\Desktop\CSDN\异常收集\bootstrap.jpg)]
这是pom.xml文件
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zCVrrLDT-1587017893110)(C:\Users\Administrator\Desktop\CSDN\异常收集\pom.jpg)]
结果启动运行就报错:
Caused by: 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 7, column 22: server-addr: @addr@
解决方案:
在pom文件中添加一下
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<delimiters>@</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>