springboot学习笔记(二)
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                springboot学习笔记(二)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 我的第一個springboot程序
1.進入spring官網,spring.io
?
2.下載完之后,導入STS
3.導入成功之后
目錄結構resources:
? ? ? 1.static:靜態文件(圖片、音頻、js、css)
? ? ? 2.templates:模板文件(模板引擎freemarker、thymeleaf;springboot默認不支持jsp文件)
? ? ? 3.application.properties? : 配置文件
運行SpringbootDemoApplication.java即可啟動springboot項目
出現以下界面代表啟動成功
4.測試
application.properties文件中可以指定tomcat端口,我這里是server.port=8080
創建一個HelloWorldController.java
package com.example.SpringbootDemo.controller;import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;@Controller public class HelloWorldController {@RequestMapping("helloworld")@ResponseBodypublic String helloworld() {return "helloworld;hello springboot";} }啟動springboot,輸入localhost:8080\helloworld,啟動成功
自此,我的第一個springboot程序運行成功!
總結
以上是生活随笔為你收集整理的springboot学习笔记(二)的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 2021中国新物业服务发展白皮书
- 下一篇: 如何模块化设计B端系统?
