我的SpringBoot的第一天
springboot的入門專案
具體步驟如下:
- 首先使用maven工程創建springboot專案
- 在pom檔案中引入父級依賴
- 然后在controller層中撰寫代碼實作
- 是用main方法以及@SpringBootApplication注解撰寫啟動類
- 最終將效果在瀏覽器中展示
具體代碼如下:
(步驟一)

(步驟二)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
(步驟三)
@RestController
@RequestMapping("hello")
public class HelloController {
@RequestMapping("test")
public String springBoot(){
return "這是第一個springboot專案";
}
}
(步驟四)
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class,args);
}
}
(步驟五)

總結
這里對springboot第一天進行總結:
以上是簡單的springboot入門小案例,主要是針對于如何撰寫springboot代碼,以及的對于springboot核心注解的使用還有如何運行,最終在瀏覽器中展示效果,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/247187.html
標籤:java
下一篇:Java入門程式
