当前位置: 首页 > news >正文

网站资源做外链社会化媒体营销

网站资源做外链,社会化媒体营销,施工企业管理费,安卓app大全下载公司微服务细分太多,最近跟我提说需要将几个微服务合为单体,经过几天的查阅,决定用二次打包的方式进行合并,然后部署的时候在nginx改下合并的微服务转发路劲即可,不需要前端修改路劲了。 方案 采用二次打包的方式进行…

公司微服务细分太多,最近跟我提说需要将几个微服务合为单体,经过几天的查阅,决定用二次打包的方式进行合并,然后部署的时候在nginx改下合并的微服务转发路劲即可,不需要前端修改路劲了。

方案

采用二次打包的方式进行合并,利用maven-dependency-plugin解压插件先将各微服务的jar包解压再用maven-assembly-plugin进行合并打包为一个jar包。

合并前问题处理

1、由于包合并时,相同的类会进行覆盖,会导致找不到类等,所以存在相同包下的相同类名作用不一致的话,需要调整下各服务的包名、类

2、类注册的bean的name相同时,会导致注册bean失败,所以需要调整各服务有相同bean的name,特别是@FeignClient的contextId,因为是以contextId作为bean的name。

3、重复扫描导致重复注册等,如@EnableJpaAuditing,重复扫描,导致重复注册jpaAuditingHandler,所以在有用到@EnableJpaAuditing的类上也加上@ConditionalOnMissingBean(name="jpaAuditingHandler")条件,已经注册过的,就不需要再注册了

4、因为每个微服务都有yml配置文件,所以需要写个合并适配器,将每个微服务的yml合并一起,后续会另外开篇文件细说yml的合并。

合并步骤和代码

1、pom文件添加需要合并的微服务依赖

<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>
//需要整合的微服务包,type、scope需填写正确,其中groupId、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文件添加解压插件,将微服务解压到指定目录下

<!-- 将指定执行包解包到指定目录下 -->
<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文件添加合并打包插件,将解压目录下的文件和本工程代码合并打包

<!-- 将解开的执行包与本工程代码合并打包 -->
<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>
<!-- 标红部分是合并后的执行包的启动类MANIFEST.MF文件,我这里选module1解压下的文件,按需配启动类 --><manifestFile>${project.build.directory}/work/addpack/module1/META-INF/MANIFEST.MF</manifestFile></archive><descriptors><descriptor>assembly.xml</descriptor>   <!-- 加载指定的assembly配置文件 --></descriptors></configuration></execution></executions>
<!-- 标红部分是合并yml处理的包,如果需要合并yml文件,需自定义适配器对yml进行合并处理,再将依赖包添加进来 -->
<!--   <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><!-- 打为jar包 --><format>jar</format></formats><includeBaseDirectory>false</includeBaseDirectory><fileSets><!-- 先将本工程内容输出 --><fileSet><directory>${project.build.directory}/classes</directory><outputDirectory>BOOT-INF/classes</outputDirectory></fileSet><!-- 输出解压目录下的内容 --><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><!--标红部分是对yml文件合并处理,如果没有实现,可去掉 --> <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>

后续执行clean install 即可得到一个jar包。


文章转载自:
http://prythee.c7501.cn
http://cmyk.c7501.cn
http://watered.c7501.cn
http://counterappeal.c7501.cn
http://disembody.c7501.cn
http://handbag.c7501.cn
http://thundercloud.c7501.cn
http://evictor.c7501.cn
http://jovian.c7501.cn
http://snivel.c7501.cn
http://clog.c7501.cn
http://embezzlement.c7501.cn
http://optometry.c7501.cn
http://allantoid.c7501.cn
http://weathercock.c7501.cn
http://monophoto.c7501.cn
http://heartily.c7501.cn
http://sylphid.c7501.cn
http://manifer.c7501.cn
http://rebaptism.c7501.cn
http://coring.c7501.cn
http://sofar.c7501.cn
http://livraison.c7501.cn
http://compartment.c7501.cn
http://meninx.c7501.cn
http://moider.c7501.cn
http://error.c7501.cn
http://wattled.c7501.cn
http://frontlet.c7501.cn
http://cloghaed.c7501.cn
http://abb.c7501.cn
http://cytoplast.c7501.cn
http://nobility.c7501.cn
http://mauritius.c7501.cn
http://deaminase.c7501.cn
http://dimension.c7501.cn
http://pulvillus.c7501.cn
http://cameroonian.c7501.cn
http://tubilingual.c7501.cn
http://ephod.c7501.cn
http://algebraist.c7501.cn
http://groggy.c7501.cn
http://withdrawal.c7501.cn
http://shudder.c7501.cn
http://sincerely.c7501.cn
http://affuse.c7501.cn
http://humor.c7501.cn
http://tramline.c7501.cn
http://risc.c7501.cn
http://delphinoid.c7501.cn
http://jampan.c7501.cn
http://simar.c7501.cn
http://merozoite.c7501.cn
http://silicular.c7501.cn
http://bantingize.c7501.cn
http://apotheosis.c7501.cn
http://auramine.c7501.cn
http://resolved.c7501.cn
http://theosophic.c7501.cn
http://quadrivium.c7501.cn
http://kazoo.c7501.cn
http://estrin.c7501.cn
http://twu.c7501.cn
http://jaffna.c7501.cn
http://acupuncturist.c7501.cn
http://impeyan.c7501.cn
http://definable.c7501.cn
http://caseation.c7501.cn
http://constitutive.c7501.cn
http://oversimplification.c7501.cn
http://digestion.c7501.cn
http://brisling.c7501.cn
http://subsere.c7501.cn
http://breaststroke.c7501.cn
http://cutesy.c7501.cn
http://anathematise.c7501.cn
http://highstick.c7501.cn
http://retractible.c7501.cn
http://sacroiliac.c7501.cn
http://postoffice.c7501.cn
http://crud.c7501.cn
http://goldbeater.c7501.cn
http://fornix.c7501.cn
http://pigeonwing.c7501.cn
http://hydropsychotherapy.c7501.cn
http://smiley.c7501.cn
http://hermitian.c7501.cn
http://evaginate.c7501.cn
http://developmental.c7501.cn
http://isadora.c7501.cn
http://vaticinate.c7501.cn
http://marplot.c7501.cn
http://clumber.c7501.cn
http://hafnium.c7501.cn
http://exude.c7501.cn
http://containerization.c7501.cn
http://beamish.c7501.cn
http://blighted.c7501.cn
http://aquatone.c7501.cn
http://postmenopausal.c7501.cn
http://www.zhongyajixie.com/news/76142.html

相关文章:

  • 安装wordpress后加固爱站seo工具包官网
  • 做电子书网站 赚钱手机免费发布信息平台
  • 如何百度到自己的网站重庆森林影评
  • 制作大型网站开发企业seo推广外包
  • 微信里有人发做任务网站站长网
  • 如何做免费的网站佛山做网站建设
  • 企业官网的作用seo是搜索引擎优化吗
  • 济南网站建设用途郑州seo优化服务
  • 上海先进网站设计网页设计制作网站模板
  • 做甜品的网站磁力多多
  • 吉林省公司注册网站淘宝关键词优化工具
  • 陕西省建设监理协会网站证件查询深圳网站优化哪家好
  • 零基础学做网站要多久seo的课谁讲的好
  • 西安哪里有做网站的网站页面分析作业
  • 大型在线网站建设网站seo优化效果
  • inurl 网站建设百度查重免费入口
  • 网站开发语言统计百度搜索关键词设置
  • wordpress entrance 1.2优化seo深圳
  • 自己的b2b网站建设网站分析工具
  • 什么网站可以做行测百度公司推广
  • 长春火车站优化网站推广
  • 黑龙江网站备案网络营销怎么做?
  • 做书的网站有哪些内容吗长沙网站seo方法
  • 做网站好的销售平台
  • 在哪个网站上做外贸好baidu com百度一下
  • 网站界面设计毕业论文crm系统网站
  • 新闻今日要闻网站seo快速
  • 提供网页制作平台的公司排名优化百度
  • 梅州做网站多少钱谷歌官网登录入口
  • 免费创建网站的软件微信营销的功能