這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)怎么進(jìn)行自定義spring-boot-starter,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、小程序設(shè)計、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了昂仁免費(fèi)建站歡迎大家使用!
springboot規(guī)定一般官網(wǎng)的包名為 spring-boot-start-xxx (spring-boot-start-web)
個人或者第三方命名規(guī)則為:xxx-spring-boot-start (pagehelper-spring-boot-start)
當(dāng)前為可引入jar包,我們創(chuàng)建maven創(chuàng)建項(xiàng)目; springboot 項(xiàng)目默認(rèn)打包jar為 可執(zhí)行文件,如果要更改成 可引入jar包,則需要更改為
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <classifier>exec</classifier> </configuration> </plugin>
詳細(xì)內(nèi)容不多解釋自行查看
//pageHelper 引入包結(jié)構(gòu)為 - |- pagehlper.jar |- pagehelper-spring-boot-autoconfigure.jar |- pagehelper-spring-boot-starter.jar //自定義包結(jié)構(gòu)為 - white-spring-boot |- white-spring-boot-autoconfigure 自動配置類 |- white-spring-boot-starter 加載類 |- white-core 核心邏輯
當(dāng)前為空項(xiàng)目,主要內(nèi)容新增文件
resources/META-INF/spring.provides
pageHelper 中引用的是如下,
provides: pagehelper-spring-boot-autoconfigure,pagehelper,mybatis-spring-boot-autoconfigure,mybatis,mybatis-spring
仿照寫
white-spring-boot-starter 中引用的是
provides: white-core, white-spring-boot-autoconfigure
仿照pagehelper-spring-boot-autoconfigure
創(chuàng)建啟動加載文件
resources/META-INF/spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.apple.WhiteAutoConfiguration
創(chuàng)建com.apple.WhiteAutoConfiguration
@Configuration @EnableConfigurationProperties(WhiteProperties.class) public class WhiteAutoConfiguration { } @ConfigurationProperties(prefix = "white") @Getter @Setter public class WhiteProperties { private Properties properties = new Properties(); public Properties getProperties() { return this.properties; } private String userName; private Integer age; }
源碼 github
上述就是小編為大家分享的怎么進(jìn)行自定義spring-boot-starter了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
分享題目:怎么進(jìn)行自定義spring-boot-starter
網(wǎng)站路徑:http://aaarwkj.com/article18/gjoigp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、微信公眾號、定制網(wǎng)站、做網(wǎng)站、網(wǎng)站設(shè)計、品牌網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)