日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

spring boot四:探究hello world

發布時間:2025/6/15 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 spring boot四:探究hello world 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. POM文件

? ?父項目:

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.9.RELEASE</version></parent>

spring boot的版本仲裁中心,以后導入依賴默認不需要寫版本.(沒有在dependencies里面管理的依賴法則自然需要聲明版本號)

2. 導入的依賴項

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>

spring-boot-starter: ?spring-boot 場景啟動器; 幫我們導入web模塊正常運行所依賴的組件。

spring-boot將所有的功能場景都抽取出來,做成一個個的starters(啟動器),只需要在項目里引入這些starter,相關場景的所有依賴都會導入進來。要用什么功能,就導入對應的場景的啟動器.

3. 主程序類,主入口類

@SpringBootApplication public class HelloWorldMainApplication {public static void main(String[] args) {// sping應用啟動起來SpringApplication.run(HelloWorldMainApplication.class, args);} } @SpringBootApplication: spring boot應用標注在某個類上說明這個類是springboot的主配置類,SpringBoot就應該運行這個類的main方法來啟動SpringBoot應用; @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan(excludeFilters = {@Filter(type = FilterType.CUSTOM,classes = {TypeExcludeFilter.class} ), @Filter(type = FilterType.CUSTOM,classes = {AutoConfigurationExcludeFilter.class} )} ) public @interface SpringBootApplication {

@SpringBootConfiguration:Spring Boot的配置類; 標注在某個類上,表示這是一個spring boot配置類.

@EnableAutoConfiguration:開啟自動配置功能。以前我們需要配置的東西,spring boot幫我們自動配置。

?

?

?

?

?

總結

以上是生活随笔為你收集整理的spring boot四:探究hello world的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。