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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM