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