天天看點

SpringBoot建立第一個Web項目——Hello SpringBoot

用idea開發工具快速建立

SpringBoot建立第一個Web項目——Hello SpringBoot
建立項目組、項目名和項目的包
SpringBoot建立第一個Web項目——Hello SpringBoot
添加web依賴
SpringBoot建立第一個Web項目——Hello SpringBoot
然後完成即可,可以看到如下的目錄結構,而且可以直接運作
SpringBoot建立第一個Web項目——Hello SpringBoot
下面我們寫一個controller
SpringBoot建立第一個Web項目——Hello SpringBoot

package com.hzy.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String show() {
        return "Hello SpringBoot";
    }
}
      

繼續閱讀