问题:application.yaml文件读取不到pom.xml下的标签值,报
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 13:
active: @spring.profiles.active@
的解决方法 :
在模块的pom.xml文件下写入(注意标签嵌套层级)
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
写入后使用mvn clean命令清除编译好的内容,重新mvn install后启动项目即可。
或者可以切换到启动类所在的Maven模块下(与该模块的pom.xml文件同级)使用mvn spring-boot:run去运行项目,运行成功后再启动即可