lichengbei
2019年12月21日
公式ウェブサイトの訪問https://start.spring.io/を、基本的なパラメータを記入し、プロジェクトファイルをダウンロードし、自動的に生成されます
ダウンロードしたプロジェクトファイルを抽出して、との考え方開くためには、configure のMaven 、書き込みコントローラは、実行xxxApplication へ
WebController.javaは、次のように読み取ります。
package com.forest.fox.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @ResponseBody public class WebController { /** * 测试:http://127.0.0.1:8080/hello-world * * @return 测试数据 */ @RequestMapping(value = "/hello-world", method = RequestMethod.GET) public String helloWorld() { return "Hello World!"; } }
使用浏览器测试:
到此,一个最简单的springboot项目已经搭建完成了。