中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)站資源做外鏈seo教程搜索引擎優(yōu)化入門與進(jìn)階

網(wǎng)站資源做外鏈,seo教程搜索引擎優(yōu)化入門與進(jìn)階,網(wǎng)站開發(fā)客戶對(duì)話,網(wǎng)站如何接廣告公司微服務(wù)細(xì)分太多,最近跟我提說需要將幾個(gè)微服務(wù)合為單體,經(jīng)過幾天的查閱,決定用二次打包的方式進(jìn)行合并,然后部署的時(shí)候在nginx改下合并的微服務(wù)轉(zhuǎn)發(fā)路勁即可,不需要前端修改路勁了。 方案 采用二次打包的方式進(jìn)行…

公司微服務(wù)細(xì)分太多,最近跟我提說需要將幾個(gè)微服務(wù)合為單體,經(jīng)過幾天的查閱,決定用二次打包的方式進(jìn)行合并,然后部署的時(shí)候在nginx改下合并的微服務(wù)轉(zhuǎn)發(fā)路勁即可,不需要前端修改路勁了。

方案

采用二次打包的方式進(jìn)行合并,利用maven-dependency-plugin解壓插件先將各微服務(wù)的jar包解壓再用maven-assembly-plugin進(jìn)行合并打包為一個(gè)jar包。

合并前問題處理

1、由于包合并時(shí),相同的類會(huì)進(jìn)行覆蓋,會(huì)導(dǎo)致找不到類等,所以存在相同包下的相同類名作用不一致的話,需要調(diào)整下各服務(wù)的包名、類

2、類注冊(cè)的bean的name相同時(shí),會(huì)導(dǎo)致注冊(cè)bean失敗,所以需要調(diào)整各服務(wù)有相同bean的name,特別是@FeignClient的contextId,因?yàn)槭且詂ontextId作為bean的name。

3、重復(fù)掃描導(dǎo)致重復(fù)注冊(cè)等,如@EnableJpaAuditing,重復(fù)掃描,導(dǎo)致重復(fù)注冊(cè)jpaAuditingHandler,所以在有用到@EnableJpaAuditing的類上也加上@ConditionalOnMissingBean(name="jpaAuditingHandler")條件,已經(jīng)注冊(cè)過的,就不需要再注冊(cè)了

4、因?yàn)槊總€(gè)微服務(wù)都有yml配置文件,所以需要寫個(gè)合并適配器,將每個(gè)微服務(wù)的yml合并一起,后續(xù)會(huì)另外開篇文件細(xì)說yml的合并。

合并步驟和代碼

1、pom文件添加需要合并的微服務(wù)依賴

<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><module1.version>6.1.0</module1.version><module2.version>6.1.0</module2.version><module3.version>6.1.0</module3.version>
</properties>
<dependencies>
//需要整合的微服務(wù)包,type、scope需填寫正確,其中g(shù)roupId、artifactId、version按需填寫即可<dependency><groupId>com.lfq.module1</groupId><artifactId>module1</artifactId><version>${module1.version}</version><type>jar</type><scope>provided</scope></dependency><dependency><groupId>com.lf1.module2</groupId><artifactId>module2</artifactId><version>${module2.version}</version><type>jar</type><scope>provided</scope></dependency><dependency><groupId>com.lf1.module3</groupId><artifactId>module3</artifactId><version>${module3.version}</version><type>jar</type><scope>provided</scope></dependency>
</dependencies>

2、pom文件添加解壓插件,將微服務(wù)解壓到指定目錄下

<!-- 將指定執(zhí)行包解包到指定目錄下 -->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><executions><execution><id>unpack-classes</id><phase>package</phase><goals><goal>unpack</goal></goals><configuration><artifactItems><artifactItem><groupId>com.lfq.module1</groupId><artifactId>module1</artifactId><outputDirectory>${project.build.directory}/work/addpack/module1</outputDirectory></artifactItem><artifactItem><groupId>com.lfq.module2</groupId><artifactId>module2</artifactId><outputDirectory>${project.build.directory}/work/addpack/module2</outputDirectory></artifactItem><artifactItem><groupId>com.lfq.module3</groupId><artifactId>module3</artifactId><outputDirectory>${project.build.directory}/work/addpack/module3</outputDirectory></artifactItem></artifactItems></configuration></execution></executions>
</plugin>

3、pom文件添加合并打包插件,將解壓目錄下的文件和本工程代碼合并打包

<!-- 將解開的執(zhí)行包與本工程代碼合并打包 -->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>3.3.0</version><configuration><recompressZippedFiles>false</recompressZippedFiles></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals><configuration><archive>
<!-- 標(biāo)紅部分是合并后的執(zhí)行包的啟動(dòng)類MANIFEST.MF文件,我這里選module1解壓下的文件,按需配啟動(dòng)類 --><manifestFile>${project.build.directory}/work/addpack/module1/META-INF/MANIFEST.MF</manifestFile></archive><descriptors><descriptor>assembly.xml</descriptor>   <!-- 加載指定的assembly配置文件 --></descriptors></configuration></execution></executions>
<!-- 標(biāo)紅部分是合并yml處理的包,如果需要合并yml文件,需自定義適配器對(duì)yml進(jìn)行合并處理,再將依賴包添加進(jìn)來 -->
<!--   <dependencies><dependency><groupId>com.fql.merge</groupId><artifactId>mergeHandle</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies>  -->
</plugin>

4、添加assembly.xml文件描述合并打包

<assembly>
<!-- id自定義 --><id>lfq</id><formats><!-- 打?yàn)閖ar包 --><format>jar</format></formats><includeBaseDirectory>false</includeBaseDirectory><fileSets><!-- 先將本工程內(nèi)容輸出 --><fileSet><directory>${project.build.directory}/classes</directory><outputDirectory>BOOT-INF/classes</outputDirectory></fileSet><!-- 輸出解壓目錄下的內(nèi)容 --><fileSet><directory>${project.build.directory}/work/addpack/module1</directory><outputDirectory>.</outputDirectory>
<!-- 這里是module1下的DbDataController類不需要輸出參與合并打包,即打包后的jar包沒有DbDataController類,按需配置 --><excludes><exclude>**/DbDataController.class</exclude></excludes></fileSet><fileSet><directory>${project.build.directory}/work/addpack/module2</directory><outputDirectory>.</outputDirectory>
<!-- 這里是module2下的application.yml不需要輸出參與合并打包,按需配置 --><excludes><exclude>**/application.yml</exclude></excludes></fileSet><fileSet><directory>${project.build.directory}/work/addpack/module3</directory><outputDirectory>.</outputDirectory></fileSet></fileSets><!--標(biāo)紅部分是對(duì)yml文件合并處理,如果沒有實(shí)現(xiàn),可去掉 --> <containerDescriptorHandlers><containerDescriptorHandler><handlerName>yml-merge</handlerName><configuration><filePattern>.*/application.yml</filePattern><outputPath>BOOT-INF/classes/application.yml</outputPath></configuration></containerDescriptorHandler></containerDescriptorHandlers><!-- 本工程依賴 --><dependencySets><dependencySet><unpack>false</unpack><useProjectArtifact>false</useProjectArtifact><outputDirectory>BOOT-INF/lib</outputDirectory></dependencySet></dependencySets>
</assembly>

后續(xù)執(zhí)行clean install 即可得到一個(gè)jar包。

http://www.risenshineclean.com/news/63885.html

相關(guān)文章:

  • 破破網(wǎng)站開發(fā)廣告推廣方案
  • wordpress自動(dòng)切換手機(jī)主題做網(wǎng)絡(luò)優(yōu)化的公司排名
  • 中山視角做網(wǎng)站的公司汽車網(wǎng)站建設(shè)
  • 網(wǎng)站建設(shè)背景需要寫些什么軟件如何設(shè)計(jì)網(wǎng)站
  • 違規(guī)網(wǎng)站開發(fā) 開發(fā)者如何規(guī)避風(fēng)險(xiǎn)網(wǎng)絡(luò)營(yíng)銷的營(yíng)銷策略
  • 對(duì)網(wǎng)站建設(shè)在電子商務(wù)中的看法如何創(chuàng)建一個(gè)屬于自己的網(wǎng)站
  • 萬(wàn)江做網(wǎng)站百度搜索引擎優(yōu)化的推廣計(jì)劃
  • 網(wǎng)站建設(shè)技術(shù)經(jīng)理崗位職責(zé)別做網(wǎng)絡(luò)推廣員
  • 醫(yī)院網(wǎng)站建設(shè)ppt新手怎么引流推廣
  • 濟(jì)南網(wǎng)站制作工作室蘭州seo公司
  • 哈爾濱網(wǎng)站建設(shè)網(wǎng)絡(luò)公司廣州seo推廣運(yùn)營(yíng)專員
  • 網(wǎng)站能帶來什么移動(dòng)建站優(yōu)化
  • 做自己的批發(fā)網(wǎng)站需要什么營(yíng)業(yè)執(zhí)照鄭州今天剛剛發(fā)生的新聞
  • 2003 您的安全設(shè)置不允許網(wǎng)站使用安裝seort什么意思
  • 南寧網(wǎng)站推廣工具seo英文
  • 用文本文檔做網(wǎng)站今日頭條搜索引擎
  • 深圳企業(yè)建站公司網(wǎng)絡(luò)營(yíng)銷推廣方案范文
  • 網(wǎng)站包括哪些內(nèi)容嗎seo發(fā)帖軟件
  • 河北工程招標(biāo)信息網(wǎng)官網(wǎng)網(wǎng)絡(luò)推廣優(yōu)化培訓(xùn)
  • dede網(wǎng)站版權(quán)信息標(biāo)簽2024年重啟核酸
  • 企業(yè)的網(wǎng)站特點(diǎn)新聞稿范文
  • 定制獨(dú)立站制作搜索關(guān)鍵詞優(yōu)化服務(wù)
  • 網(wǎng)上接單做衣服哪個(gè)網(wǎng)站如何創(chuàng)建一個(gè)自己的網(wǎng)站
  • wordpress后臺(tái)權(quán)限南寧企業(yè)官網(wǎng)seo
  • 品牌建設(shè)和品牌推廣優(yōu)化網(wǎng)站打開速度
  • 重慶設(shè)計(jì)網(wǎng)站鄭州建網(wǎng)站的公司
  • 網(wǎng)站流量少怎么辦蕭山seo
  • 網(wǎng)站建設(shè)記在哪個(gè)科目app優(yōu)化方案
  • 以下屬于購(gòu)物搜索廣告的是溫州seo教程
  • 軟件開發(fā)公司企業(yè)簡(jiǎn)介溫州網(wǎng)站建設(shè)優(yōu)化