Eclipse如何搭建Spring Boot微服務程序

微服務可以說是目前非常流行項目架構模式,不管是大公司還是小企業目前找人都是懂微服務的優先,希望大家一定要學會。

Eclipse如何搭建Spring Boot微服務程序

搭建Spring Boot應用程序,可以讓我們快速的啟動一個微服務應用,下面開始搭建步驟。

1.首選我們的Eclipse需要安裝能搭建Spring Boot的插件,可以百度如何安裝。

Eclipse如何搭建Spring Boot微服務程序

2.右鍵新建項目,選擇Spring Starter Project。

Eclipse如何搭建Spring Boot微服務程序

3.下一步,按照如下選項進行選擇,打包方式選擇Jar包(war包方式後續介紹)。

Eclipse如何搭建Spring Boot微服務程序

4.下一步,選擇Spring Boot應用模板,選擇如下兩項即可。

Eclipse如何搭建Spring Boot微服務程序

5.點擊finish即可,項目的工程結構如下。

Eclipse如何搭建Spring Boot微服務程序

6.下面創建一個HelloWorld.java,是一個Controller,代碼如下:

Eclipse如何搭建Spring Boot微服務程序

7.以上配置完,即可啟動Spring Boot應用程序,在啟動類右鍵-》run as-》Spring Boot App。

Eclipse如何搭建Spring Boot微服務程序

Eclipse如何搭建Spring Boot微服務程序

Eclipse如何搭建Spring Boot微服務程序

8.在瀏覽器中運行如下連接,即可訪問:http://localhost:8080/test/hello

Eclipse如何搭建Spring Boot微服務程序

9.以上就是如何在Eclispe下運行Spring Boot應用程序。後續我將介紹如何打成Jar包或war的方式獨立運行Spring Boot 應用程序。


分享到:


相關文章: