Spring boot启动报异常‘FAILED TO LOAD PROPERTY SOURCE FROM LOCATION 'CLASSPATH:/APPLICATION.YML’

学习springboot,在启动时抛出下图异常'

java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:524)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:473)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:443)

at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6(ConfigFileApplicationListener.java:425)

at java.lang.Iterable.forEach(Iterable.java:75)

往下看异常信息,找到异常的具体位置


首行报出: Failed to load property source from location 'classpath:/application.yml' 在尾部可以看到报出出错位置:line8,colum 9


在搭建数据库信息时从第八行的头部位置多了一个空格导致启动失败,多一个空格或者少一个空格都会引起此报错导致启动失败。


去掉空格,项目就可以正常运行了。

你可能感兴趣的:(Spring boot启动报异常‘FAILED TO LOAD PROPERTY SOURCE FROM LOCATION 'CLASSPATH:/APPLICATION.YML’)