Spring Boot启动失败问题:hile scanning for the next token found character '@' that cannot start any token. (Do not use @ for indentation)

IDE:InteliJ

某天,前一次运行application还可以正常启动springboot项目,重启就出现启动失败,提示:

hile scanning for the next token found character '@' that cannot start any token. (Do not use @ for indentation)

大意就是在你的yaml配置文件中使用了InteliJ不能识别的@符号,众所周知,@@一般用于读取pom中的配置信息,例如:

spring:
    datasource:
        url: @jdbc_url@?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
        username: @db_username@
        password: @db_password@ 

可能在IDE官方那非常不推荐这样的做法,但也是有解决办法的,只要到项目目录下执行如下命令,和打maven包同理同目录。

mvn spring-boot:run

目的是让利用maven命令启动一次项目,把pom给解析了,关闭命令提示簿之后,再回到InteliJ里就可以启动了。

posted @ 2020-02-27 10:59  wxxwjef  阅读(7944)  评论(1编辑  收藏  举报