Spring Boot启动失败问题:hile scanning for the next token found character '@'

简介: Spring Boot启动失败问题:hile scanning for the next token found character '@'

IDE:InteliJ

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

1
hile scanning for the next token found character '@' that cannot start any token. (Do not use @ for indentation)
大意就是在你的yaml配置文件中使用了InteliJ不能识别的@符号,众所周知,@@一般用于读取pom中的配置信息,例如:

1
2
3
4
5
spring:
datasource:
url: @jdbc_url@?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8

//代码效果参考:http://www.zidongmutanji.com/bxxx/532652.html
username: @db_username@
password: @db_password@
可能在IDE官方那非常不推荐这样的做法,但也是有解决办法的,只要到项目目录下执行如下命令,和打maven包同理同目录。

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

相关文章
|
1月前
|
JSON 前端开发 Java
解决Spring MVC中No converter found for return value of type异常
在Spring MVC开发中遇到`No converter found for return value of type`异常,通常是因缺少消息转换器、返回值类型不支持或转换器优先级配置错误。解决方案包括:1) 添加对应的消息转换器,如`MappingJackson2HttpMessageConverter`;2) 自定义消息转换器并实现`HttpMessageConverter`接口,设置优先级;3) 修改返回值类型为如`ResponseEntity`的合适类型。通过这些方法可确保返回值正确转换为响应内容。
95 1
|
3天前
|
Java
springboot自定义拦截器,校验token
springboot自定义拦截器,校验token
20 6
|
1月前
|
Java
SpringBoot:Invalid bound statement (not found)的原因和解决方案
SpringBoot:Invalid bound statement (not found)的原因和解决方案
|
1月前
|
Java 数据库连接 数据安全/隐私保护
springBoot集成token认证,最全Java面试知识点梳理
springBoot集成token认证,最全Java面试知识点梳理
|
8月前
|
Java 微服务 Spring
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
69 0
|
1月前
|
监控 NoSQL Java
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
Spring Boot集成Redis启动失败【Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.G】
|
1月前
|
JSON 前端开发 NoSQL
【三】springboot整合token
【三】springboot整合token
53 0
|
1月前
|
存储 安全 Java
Spring Security中Token存储与会话管理:解析与实践
Spring Security中Token存储与会话管理:解析与实践
146 0
|
1月前
|
SQL Java 数据库连接
Spring-Security & JWT 实现 token
Spring-Security & JWT 实现 token
39 0
|
1月前
|
存储 Java Maven
springboot项目中使用shiro 自定义过滤器和token的方式
springboot项目中使用shiro 自定义过滤器和token的方式
50 1