springCloud配置Eureka报错:java.net.ConnectException: Connection refused: connect且endpoint为localhost:端口号

这个bug的出现是因为往往是因为配置文件的问题。进过排查pom文件,发现在Eureka的微服务中,将该module的打包方式设为了pom,这不仅导致了我的endPoint一直是本地地址(target目录下没有yml的编译文件),也致使项目一直无法启动Eureka客户端。

问题解决:

将Eureka模块中的pom文件打包方式设为jar。如下图
springCloud配置Eureka报错:java.net.ConnectException: Connection refused: connect且endpoint为localhost:端口号
当然,也可以省略,因打包方式省略是时默认是jar包springCloud配置Eureka报错:java.net.ConnectException: Connection refused: connect且endpoint为localhost:端口号

再次启动Eureka客户端,成功
springCloud配置Eureka报错:java.net.ConnectException: Connection refused: connect且endpoint为localhost:端口号