【圖文詳細】SpringBoot架構搭建

打開IntelliJ IDEA 或者是IntelliJ IDEA Community Edition

 

F inish!

創建之後的目錄結構及重要操作的文件和文件夾

複製這段:
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
</parent>
<properties>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

下面會有這個顯示,正在下載的意思吧,建立依賴之類的。

等它下面的進度沒了之後,再進行下一步:

複製這一段:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.swing.*;

@EnableAutoConfiguration
@RestController
public class demo {

    @RequestMapping("/")
    public String home(){
        return "Hello World";
    }

    public static void main(String[] args) {
        System.out.println("helloworld");
        SpringApplication.run(demo.class,args);
    }

}

好了,開始配置運行環境

run!

成功操作!再在瀏覽器上輸入http://localhost:8080/看到Hello World,就ok了!

完成!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章