Spring boot 快速入門

  • 安裝idea(自行百度)
  • 使用idea 創建工程

添加Controller

package com.it11.zzf.controller;

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

/**
 * @author zzf
 * @Title: TestController
 * @ProjectName demo
 * @Description: TODO
 * @date 2020/3/28:36 PM
 */
@RestController
@RequestMapping("test")
public class TestController {


    @RequestMapping("/hello")
    public Object helle(){

        return "hello it11";
    }
}

添加運行類:

package com.it11.zzf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author zzf
 * @Title: App
 * @ProjectName demo
 * @Description: TODO
 * @date 2020/3/28:42 PM
 */
@SpringBootApplication
public class App {

     public static void main(String[] args)  {

         SpringApplication.run(App.class);
      }
}

 

運行App主類效果:

 

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