启动错误日志呢 
如题,这个问题其实很早之前就遇到过,是同样的报错,虽然可能具体的原因有些不同,但忘了记录,这次说什么也要记录下来长个记性。
说来也离奇,通常在使用IDEA启动调试SpringBoot就算是启动不了,至少还有一些日志能够帮助我们排查出是什么问题,但这次遇到的只有下面这个,除此之外什么什么也没有了!
1 2 Process finished with exit  code 1 
 
这可着实无从下手,还有一种启动失败错误如下,也是非常常见的。
1 2 3 4 Connected to the target VM, address: '127.0.0.1:56302' , transport: 'socket'  Disconnected from the target VM, address: '127.0.0.1:56302' , transport: 'socket'  Process finished with exit  code 1 
 
 
给我吐出来 
如果遇到上面的问题,可能有以下原因:
端口占用,这个还是比较常见的,一般是之前存留的进程还在,导致端口占用,无法启动;这时可以尝试找到已经被使用的端口,查看该进程是否可以为你的进程让路,如果可以就杀掉再次尝试启动,如果杀掉进程或是换了确认没有占用的端口,还是会出现上面的错误,那么就可能比较麻烦了。 
配置文件的问题,这个就要具体分析 
 
上面说了两个比较常见的原因,其实,仅仅通过几行不关键的错误信息是无法准确人判断的,所以还是建议在启动方法上加上捕获异常的,并抛出,需要注意这里要catch(Throwable e)哦。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @EnableFeignClients @EnableDiscoveryClient @SpringBootApplication @Slf4j public  class  SystemServiceApplication  {    public  static  void  main (String[] args)  {         try  {             log.info("开始启动。。。" );             SpringApplication.run(SystemServiceApplication.class, args);         } catch  (Throwable e) {             e.printStackTrace();         }     } } 
 
这样做的话就有很明确人原因指向了,没错,我启动失败原因就是下面这个
1 2 3 4 5 while  scanning for  the next tokenfound character '@'  that cannot start any token. (Do not use @ for  indentation)  in  'reader' , line 8, column 11:         name: @artifactId@               ^ 
 
主要还是因为我想通过项目的pom文件去控制整体环境,但是忽略了占位符替换的配置,详细原因请看下面这篇博客。
https://blog.csdn.net/qq_41376740/article/details/122792411?spm=1001.2014.3001.5501
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 <resources >   <resource >      <directory > src/main/resources</directory >           <excludes >        <exclude > **/*.xml</exclude >      </excludes >      <filtering > true</filtering >    </resource >    <resource >      <directory > src/main/resources</directory >           <includes >        <include > **/*.xml</include >      </includes >      <filtering > false</filtering >    </resource >  </resources > 
 
有缘再见了