欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

springboot application.yml使用@@pom文件配置問題

 更新時(shí)間:2023年07月20日 10:16:26   作者:blowDestiny  
這篇文章主要介紹了springboot application.yml使用@@pom文件配置問題,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

springboot application.yml使用@@pom文件配置

這幾天搞了一下mongodb到springboot 在配置我使用了yml的配置文件 在引用pom文件配置時(shí)需要進(jìn)行配置才可以使用@@

<build>
? ? ? ? <!-- 使用 @@ application.yml 獲取pom文件中的配置 ?-->
? ? ? ? <resources>
? ? ? ? ? ? <resource>
? ? ? ? ? ? ? ? <directory>src/main/resources</directory>
? ? ? ? ? ? ? ? <filtering>true</filtering>
? ? ? ? ? ? </resource>
? ? ? ? </resources>
</build>

如果沒有配置指定resources的話 在使用@@獲取pom文件配置的時(shí)候就會(huì)爆出:

'@' that cannot start any token. (Do not use @ for indentation)

springboot中application.yaml無法使用@@讀取pom.xml中標(biāo)簽值的問題

application.yaml文件讀取不到pom.xml下的標(biāo)簽值,報(bào)

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>
? ? <!--重要 如果不設(shè)置resource 會(huì)導(dǎo)致application.yaml中的@@找不到pom文件中的配置-->
? ? <resources>
? ? ? ? <resource>
? ? ? ? ? ? <directory>src/main/resources</directory>
? ? ? ? ? ? <filtering>true</filtering>
? ? ? ? </resource>
? ? </resources>
? ? <!--重要 如果不設(shè)置resource 會(huì)導(dǎo)致application.yaml中的@@找不到pom文件中的配置-->
? ? <plugins>
? ? ? ? <plugin>
? ? ? ? ? ? <groupId>org.springframework.boot</groupId>
? ? ? ? ? ? <artifactId>spring-boot-maven-plugin</artifactId>
? ? ? ? </plugin>
? ? </plugins>
</build>

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論