來一張eureka server的截圖
可見服務沒有注冊成功
再來一張eureka client的截圖
2開頭的狀态碼表示請求成功了
由于我的程式是從spring.start.io生成解壓的,是以這個maven項目導入的依賴就隻有eureka-client和spring-boot-start-test
通過查找資料,得知需要在pom檔案中添加spring-boot-starter-web的依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
加入之後重新啟動該client應用
打開注冊中心發現該應用已經成功.