springboot项目启动失败
对于spring boot项目默认启动的时候,终端日志什么错误信息都没有打印,直接就启动失败了,就看到这么一句提示
spring boot Process finished with exit code 1
这样我们确实不知道失败原因在哪里,
我们可以这样调试,把错误找出来。
在启动类里面加上try catch语句
我们接着启动项目,从终端日志我们看出来,首先报的错误是
Exception in thread "main" org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 2
原因:传输文件的时候编码解码格式不对
解决:
(1)第一步:将idea环境的编码确认为UTF-8
(2)第二步:复制yml文件中的内容,删除原来的.yml文件--->重新创建同名的.yml文件---->将原来的内容粘贴进去。
完成以上两边这个问题就解决了。
我们接着启动springboot项目
错误日志:java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z
分析问题:
jar包冲突
解决:
IDEA按住shift+shift
将pom文件里面的这个依赖注释掉
重新启动项目
启动成功啦!