缘起
我使用Spring Boot连接我的数据库,但是我的数据库的密码是以@
开头的。
在application.yaml
中设置好密码以后遇到如下的错误:
[main] ERROR org.springframework.boot.SpringApplication - Application run failed
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 8, column 15:
password: @******
解决方法
在application.yaml
中设置密码的时候,前后加上双引号/单引号即可。
如果没有涉及到特殊字符的话,这个密码是可以直接写的。