日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網營銷解決方案
springboot中HelloWorldApplication的探究是怎樣的

springboot中Hello World Application的探究是怎樣的,相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個問題。

成都創(chuàng)新互聯(lián)公司主要從事網站制作、網站設計、網頁設計、企業(yè)做網站、公司建網站等業(yè)務。立足成都服務尼金平,10余年網站建設經驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:028-86922220

1. POM文件

1. 父項目

    
        org.springframework.boot
        spring-boot-starter-parent
        1.5.9.RELEASE
    
    
    spring-boot-starter-parent的父項目:
    
		org.springframework.boot
		spring-boot-dependencies
		1.5.9.RELEASE
		../../spring-boot-dependencies
	
	
	spring-boot-dependencies真正來管理Spring Boot項目中所有的依賴版本

Spring Boot的版本仲裁中心,以后我們導入依賴默認不需要寫版本(沒有在spring-boot-dependencies中的依賴就需要聲明版本號)

2. 導入的依賴

        
            org.springframework.boot
            spring-boot-starter-web
        

spring-boot-starter-web :

  • spring-boot-starter: spring boot場景啟動器

2. 主程序類,主入口類

/**
 * @SpringBootApplication 來標注一個主程序類,說明這是一個Spring boot應用
 */
@SpringBootApplication
public class HelloWorldMainApplication {

    public static void main(String[] args) {

        //啟動Spring應用
        SpringApplication.run(HelloWorldMainApplication.class, args);
    }
}

@SpringBootApplication: Spring Boot應用注解,標注在某個類上說明這是Spring Boot應用的主入口類,SpringBoot就應該運行這個類的main方法來啟動應用SpringBoot應用

@SpringBootAppliation

@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 {
    @AliasFor(
        annotation = EnableAutoConfiguration.class,
        attribute = "exclude"
    )
    Class[] exclude() default {};

    @AliasFor(
        annotation = EnableAutoConfiguration.class,
        attribute = "excludeName"
    )
    String[] excludeName() default {};

    @AliasFor(
        annotation = ComponentScan.class,
        attribute = "basePackages"
    )
    String[] scanBasePackages() default {};

    @AliasFor(
        annotation = ComponentScan.class,
        attribute = "basePackageClasses"
    )
    Class[] scanBasePackageClasses() default {};
}

@SpringBootConfiguration

  • SpringBoot的配置類,標準在某個類上,表示這是一個SpringBoot的配置類

  • @Configuration:配置類(配置文件) -- 也是一個組件Component

@EnableAutoConfiguration

  • 開啟自動配置功能

看完上述內容,你們掌握springboot中Hello World Application的探究是怎樣的的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


文章名稱:springboot中HelloWorldApplication的探究是怎樣的
當前URL:http://www.dlmjj.cn/article/ipihgc.html