SpringBoot中application.yml无法使用@@读取pom.xml中标签值

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>   
<!--重要 如果不设置resource 会导致application.yaml中的@@找不到pom文件中的配置-->    
    <resources>       
        <resource>            
            <directory>src/main/resources</directory>
            <filtering>true</filtering>        
        </resource>    
    </resources>
</build>

 

posted @ 2020-06-04 14:36  长情白月光  阅读(1967)  评论(0编辑  收藏  举报