SpringBoot節

StringInitializrプロジェクトを作成します。1.(手順)

  (1)

  

  (2)

  

  (3)

  

 

   (4)

  

 

2、DemoApplicationクラス

パッケージcom.example.demo。

輸入org.springframework.boot.SpringApplication。
輸入org.springframework.boot.autoconfigure.SpringBootApplication。
輸入org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration。

@SpringBootApplication(除外 = {DataSourceAutoConfiguration。クラス})
 パブリック クラスDemoApplication {
     公共 静的 ボイドメイン(文字列[]引数){
        SpringApplication.run(DemoApplication。クラス、引数)。
    }

}

3、コントローラクラスを作成

パッケージcom.example.demo.controller。

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class sss {
    @RequestMapping("/hello")
    @ResponseBody
    public String deom(){
        return "Hello Word!!!";
    }
}

4、启动控制台DemoApplication类,运行结果如下

 5、启动页面,运行结果如下

 

 

 

 

おすすめ

転載: www.cnblogs.com/Chencheno/p/11978387.html