SpringBoot2(一)SpringBoot入門程式
在整合SSM框架時,需要大量的組態檔,SpringBoot可以簡化這些配置,提高開發效率,并且Spring內置了Tomcat、Jetty、Undertow容器,
搭建SpringBoot2的環境
方法一:通過官網生成專案
進入官網https://start.spring.io/,選擇構建工具、輸入坐標等資訊后點擊Generate,

將下載的壓縮包解壓后使用idea打開專案j即可,
方法二:使用idea
打開idea新建專案或模塊,默認的Server URL不穩定,可以設定為
start.springboot.io

下面創建一個類MyController
@Controller public class MyController { @RequestMapping("/example")//訪問路徑 @ResponseBody//表示回傳json物件 public String index(){ return "This is a simple example."; } }
點擊運行按鈕即可

接下來在瀏覽器輸入http://localhost:8080/example即可訪問

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/542273.html
標籤:其他
下一篇:go語言寫http踩得坑
