org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@‘ t

问题

SpringBoot项目,用的是yaml格式的配置,之前一切OK,今天启动突然报了个错;

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)

分析

Do not use @ for indentation

在配置文件里的确定义了一个这样的变量:

level.cn.gwssi: @logging.level@

使用 @ 这样的格式是为了让yml读取 maven pom文件中 profile变量,pom.xml中的变量如下:

          <properties>
              <spring.active>local</spring.active>
              <logging.level>DEBUG</logging.level>
          </properties>

解决

尝试 maven reimport ,问题解决。



参考:

【1】:Spring Boot property expansion not working after switching from Eclipse to IntelliJ

猜你喜欢

转载自blog.csdn.net/sinat_40770656/article/details/109668978