成人无码视频,亚洲精品久久久久av无码,午夜精品久久久久久毛片,亚洲 中文字幕 日韩 无码

資訊專欄INFORMATION COLUMN

SpringBoot之Starter

kun_jian / 1906人閱讀

摘要:序的主要用來(lái)簡(jiǎn)化依賴用的。本文主要分兩部分,一部分是列出一些的依賴,另一部分是教你自己寫一個(gè)。

SpringBoot的starter主要用來(lái)簡(jiǎn)化依賴用的。本文主要分兩部分,一部分是列出一些starter的依賴,另一部分是教你自己寫一個(gè)starter。

部分starters的依賴
Starter(Group ID: org.springframework.boot) 傳遞依賴于
spring-boot-starter-log4j2 ■ org.apache.logging.log4j:log4j-slf4j-impl
■ org.apache.logging.log4j:log4j-api
■ org.apache.logging.log4j:log4j-core
■ org.slf4j:jcl-over-slf4j
■ org.slf4j:jul-to-slf4j
spring-boot-starter-logging ■ ch.qos.logback:logback-classic
■ org.slf4j:jcl-over-slf4j
■ org.slf4j:jul-to-slf4j
■ org.slf4j:log4j-over-slf4j
spring-boot-starter-mail ■ org.springframework.boot:spring-boot-starter
■ org.springframework:spring-context
■ org.springframework:spring-context-support
■ com.sun.mail:javax.mail
spring-boot-starter-mobile ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ org.springframework.mobile:spring-mobile-device
spring-boot-starter-mustache ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ com.samskivert:jmustache
spring-boot-starter-redis ■ org.springframework.boot:spring-boot-starter
■ org.springframework.data:spring-data-redis
■ redis.clients:jedis
spring-boot-starter-remote-shell ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-actuator
■ org.crashub:crash.cli
■ org.crashub:crash.connectors.ssh (excludes org.codehaus.groovy:groovy-all)
■ org.crashub:crash.connectors.telnet (excludes javax.servlet:servlet-api, log4j :log4j, commons-logging:commons-logging)
■ org.crashub:crash.embed.spring(excludes org.springframework:spring-web, org.codehaus.groovy:groovy-all)
■ org.crashub:crash.plugins.cron (excludes org.codehaus.groovy:groovy-all)
■ org.crashub:crash.plugins.mail (excludes org.codehaus.groovy:groovy-all)
■ org.crashub:crash.shell (excludes org.codehaus.groovy:groovy-all)
■ org.codehaus.groovy:groovy
spring-boot-starter-security ■ org.springframework.boot:spring-boot-starter
■ org.springframework:spring-aop
■org.springframework.security:spring-security-config
■org.springframework.security:spring-security-web
spring-boot-starter-social-facebook ■org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■org.springframework.social:spring-social-config
■ org.springframework.social:spring-social-core
■ org.springframework.social:spring-social-web
■org.springframework.social:spring-social-facebook
spring-boot-starter-social-linkedin ■org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■org.springframework.social:spring-social-config
■ org.springframework.social:spring-social-core
■ org.springframework.social:spring-social-web
■org.springframework.social:spring-social-linkedin
spring-boot-starter-social-twitter ■org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ org.springframework.social:spring-social-config
■ org.springframework.social:spring-social-core
■org.springframework.social:spring-social-web
■ org.springframework.social:spring-social-twitter
spring-boot-starter-test ■ junit:junit
■ org.mockito:mockito-core
■ org.hamcrest:hamcrest-core
■ org.hamcrest:hamcrest-library
■ org.springframework:spring-core(excludes commons-logging:commons-logging)
■ org.springframework:spring-test
spring-boot-starter-thymeleaf ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ org.thymeleaf:thymeleaf-spring4
■nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect
spring-boot-starter-tomcat ■ org.apache.tomcat.embed:tomcat-embed-core
■ org.apache.tomcat.embed:tomcat-embed-el
■org.apache.tomcat.embed:tomcat-embed-logging-juli
■org.apache.tomcat.embed:tomcat-embed-websocket
spring-boot-starter-undertow ■ io.undertow:undertow-core
■ io.undertow:undertow-servlet(excludes org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec)
■ io.undertow:undertow-websockets-jsr
■ javax.servlet:javax.servlet-api
■ org.glassfish:javax.el
spring-boot-starter-validation ■ org.springframework.boot:spring-boot-starter
■ org.apache.tomcat.embed:tomcat-embed-el
■org.hibernate:hibernate-validator
spring-boot-starter-velocity ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ commons-beanutils:commons-beanutils
■ commons-collections:commons-collections
■ commons-digester:commons-digester
■ org.apache.velocity:velocity
■ org.apache.velocity:velocity-tools
■ org.springframework:spring-context-support
spring-boot-starter-web ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-tomcat
■ org.springframework.boot:spring-boot-starter-validation
■com.fasterxml.jackson.core:jackson-databind
■ org.springframework:spring-web
■ org.springframework:spring-webmvc
spring-boot-starter-websocket ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web
■ org.springframework:spring-messaging
■org.springframework:spring-websocket
spring-boot-starter-ws ■ org.springframework.boot:spring-boot-starter
■ org.springframework.boot:spring-boot-starter-web ■org.springframework:spring-jms
■ org.springframework:spring-oxm
■ org.springframework.ws:spring-ws-core
■ org.springframework.ws:spring-ws-support
Reference

來(lái)自<>的附錄B SpringBoot Starters的內(nèi)容

如何自己寫starter 主要步驟

1、選擇已有的starters,在此基礎(chǔ)上進(jìn)行擴(kuò)展.

2、創(chuàng)建自動(dòng)配置文件并設(shè)定META-INF/spring.factories里的內(nèi)容.

3、發(fā)布你的starter

添加依賴管理

        
            
                org.springframework.boot
                spring-boot-dependencies
                ${spring.boot.version}
                pom
                import
            
        
添加starter自己的依賴

        
            org.springframework.boot
            spring-boot-starter
        
        
            org.springframework.boot
            spring-boot-starter-web
        
新建configuration
@Configuration
@ComponentScan( basePackages = {"com.codecraft.actuator"} )
public class WebAutoConfiguration {

    /**
     * addViewController方法不支持placeholder的解析
     * 故在這里用變量解析出來(lái)
     */
    @Value("${actuator.web.base:}")
    String actuatorBase;

//    @Bean
//    public ActuatorNavController actuatorNavController(){
//        return new ActuatorNavController();
//    }

    @Bean
    public WebMvcConfigurerAdapter configStaticMapping() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addViewControllers(ViewControllerRegistry registry) {
                //配置跳轉(zhuǎn)
                registry.addViewController(actuatorBase+"/nav").setViewName(
                        "forward:/static/nav.html");
            }

            @Override
            public void addResourceHandlers(ResourceHandlerRegistry registry) {
                registry.addResourceHandler("/static/**").
                        addResourceLocations("classpath:/static/");
            }
        };
    }

}
修改/META-INF/spring.factories
# AutoConfigurations
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.codecraft.actuator.configuration.WebAutoConfiguration
發(fā)布
mvn clean install
引用
        
            com.codecraft
            spring-boot-starter-actuator-web
            1.0-SNAPSHOT
        
啟動(dòng)訪問(wèn)
mvn spring-boot:run

訪問(wèn)

http://localhost:8080/nav

note

Spring Boot:定制自己的starter

Boot your own infrastructure – Extending Spring Boot in five steps

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/65371.html

相關(guān)文章

  • SpringBoot非官方教程 | 第一篇:構(gòu)建第一個(gè)SpringBoot工程

    摘要:簡(jiǎn)介它的設(shè)計(jì)目的就是為例簡(jiǎn)化開發(fā),開啟了各種自動(dòng)裝配,你不想寫各種配置文件,引入相關(guān)的依賴就能迅速搭建起一個(gè)工程。它采用的是建立生產(chǎn)就緒的應(yīng)用程序觀點(diǎn),優(yōu)先于配置的慣例。另,本系列教程全部用的作為開發(fā)工具。 簡(jiǎn)介 spring boot 它的設(shè)計(jì)目的就是為例簡(jiǎn)化開發(fā),開啟了各種自動(dòng)裝配,你不想寫各種配置文件,引入相關(guān)的依賴就能迅速搭建起一個(gè)web工程。它采用的是建立生產(chǎn)就緒的應(yīng)用程序觀...

    Cheriselalala 評(píng)論0 收藏0
  • 【Java入門】SpringBoot自動(dòng)配置原理

    摘要:作者譚淼一運(yùn)行原理的運(yùn)行是由注解提供的。完成自動(dòng)配置類。自動(dòng)配置類主要作用是的配置核心,它會(huì)寫在中,告知在啟動(dòng)時(shí)去讀取該類并根據(jù)該類的規(guī)則進(jìn)行配置。會(huì)檢測(cè)是否存在類類會(huì)查看是否開啟該自動(dòng)配置。 作者:譚淼 一、運(yùn)行原理 Spring Boot的運(yùn)行是由注解@EnableAutoConfiguration提供的。 @Target({ElementType.TYPE}) @Retentio...

    468122151 評(píng)論0 收藏0
  • SpringBoot 2.X Kotlin 系列Hello World

    摘要:二教程環(huán)境三創(chuàng)建項(xiàng)目創(chuàng)建項(xiàng)目有兩種方式一種是在官網(wǎng)上創(chuàng)建二是在上創(chuàng)建如圖所示勾選然后點(diǎn),然后一直默認(rèn)最后點(diǎn)擊完成即可。我們這里看到和普通的接口沒(méi)有異同,除了返回類型是用包裝之外。與之對(duì)應(yīng)的還有,這個(gè)后面我們會(huì)講到。 showImg(https://segmentfault.com/img/remote/1460000018819338?w=1024&h=500); 從去年開始就開始學(xué)習(xí)...

    warkiz 評(píng)論0 收藏0
  • 一起學(xué)習(xí)使用Spring Cloud NetflixEureka

    摘要:筆者也是初學(xué)者,本文從創(chuàng)建項(xiàng)目工程開始,一步一步開始講解如何創(chuàng)建服務(wù)端和客戶端,一起學(xué)習(xí),共同進(jìn)步。下面我們使用工具創(chuàng)建相關(guān)項(xiàng)目。配置其中兩個(gè)屬性表明這個(gè)應(yīng)用是端,而不是端。至此,端和端已經(jīng)部署成功。 前言 spring cloud為互聯(lián)企業(yè)構(gòu)建微服務(wù)提供了一整套的技術(shù)組件,其中Eureka是Spring Cloud體系中的核心。Netfix不是一個(gè)技術(shù)概念,它原本是國(guó)外一個(gè)視頻網(wǎng)站的...

    李義 評(píng)論0 收藏0
  • 從0開始學(xué)springboot啟蒙篇

    摘要:下載地址百度谷歌一大堆以下介紹如何使用自帶的下載下載請(qǐng)選擇版本創(chuàng)建一個(gè)項(xiàng)目輸入輸入輸入修改為如下將自動(dòng)下載以及相關(guān)依賴包至此工程已經(jīng)搭建完畢,下一篇將是一個(gè) (why)為什么springboot火遍全世界 springboot 有個(gè)好爹spring springboot 遺傳了爹的優(yōu)秀基因而生 大神們都在講服務(wù)化(service),springboot做服務(wù)化再合適不過(guò)了 sprin...

    zhangxiangliang 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

閱讀需要支付1元查看
<