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

科技类网站模板宁波seo外包平台

科技类网站模板,宁波seo外包平台,建设网站怎么做,在哪找做调查赚钱的网站好需求: 使用 Maven根据不同的构建环境(如开发、测试、生产)来定义不同的配置,实现灵活的构建管理。 需要Demo项目的可以参考:我的demo项目 一、项目分层 一般的初创项目不会有特别多的配置文件,所以使用 spring.profile…

需求:
使用 Maven根据不同的构建环境(如开发、测试、生产)来定义不同的配置,实现灵活的构建管理。
需要Demo项目的可以参考:我的demo项目

一、项目分层

一般的初创项目不会有特别多的配置文件,所以使用 spring.profiles.active就可以满足需求,但伴随项目规模扩大,引入的依赖/中间件越多,配置文件越多,仅仅靠单一的文件无法满足,可以参考下面的结构:

├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │       └── github
│   │   └── resources
│   │       ├── resources-env
│   │       │   ├── dev
│   │       │   └── prod
│   │       └── static

1. 使用 Maven 配置不同环境

在 Maven 中,<profiles> 是一个非常强大的功能,它允许你根据不同的构建环境(如开发、测试、生产)来定义不同的配置。在 pom.xml 文件中使用 <profiles>,可以对插件、依赖、属性等进行差异化配置,进而实现灵活的构建管理。

1.1 配置不同的环境

pom.xml配置如下:

<profiles><!-- 本地开发 --><profile><id>dev</id><properties><env>dev</env></properties><activation><activeByDefault>true</activeByDefault> <!-- 默认使用 dev --></activation></profile><!-- 测试 --><profile><id>test</id><properties><env>test</env></properties></profile><!-- 预发 --><profile><id>pre</id><properties><env>pre</env></properties></profile><!-- 生产 --><profile><id>prod</id><properties><env>prod</env></properties></profile>
</profiles>

1.2 配置构建信息

pom.xml文件如下:

 <build><resources><resource><directory>src/main/resources</directory><filtering>true</filtering></resource><resource><directory>src/main/resources/resources-env/${env}</directory><filtering>true</filtering> <!-- 启用资源过滤 --></resource></resources><plugins><!--     spring 配置文件可以使用占位符读取pom.xml中的变量 例如 @env@       --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.2.0</version><configuration><delimiters><delimiter>@</delimiter></delimiters><useDefaultDelimiters>false</useDefaultDelimiters></configuration></plugin></plugins></build>

1.3 Spring 配置文件激活不同环境的配置文件

application.properties 文件配置如下:

spring.profiles.active=@env@

1.4 构建项目

命令参考:

mvn clean package -Pprod

二、可能遇到的问题

2.1 IDEA直接启动项目,读取不到环境配置文件

项目环境变量设置有问题。

解决方法:
IDEA 操作 File -> Project Structure -> Modules 设置 Resources 就可以了

在这里插入图片描述

2.2 启动项目,报错:IOException: DerInputStream.getLength()

错误原因是因为 <filtering>true</filtering> 会进行文件过滤,非纯文本文件(例如.p12二进制文件)需要进一步配置。

参考:解决方案

2.3 Maven 打包缺少环境配置文件

Spring 项目配置文件位置:

  • 默认 src/main/resources 目录下的文件
  • config 子目录下的配置文件

打包时需要进一步处理。

参考:解决方案

三、进一步优化

3.1 缩小应用jar包的体积

伴随项目依赖越来越大,应用jar包的体积会越来越大,可以进一步优化。

参考:优化依赖打包


文章转载自:
http://parliamental.hmxb.cn
http://misrepresent.hmxb.cn
http://aapss.hmxb.cn
http://chemosterilant.hmxb.cn
http://joining.hmxb.cn
http://fretsaw.hmxb.cn
http://locoplant.hmxb.cn
http://preaching.hmxb.cn
http://eyetooth.hmxb.cn
http://destructionist.hmxb.cn
http://germanomania.hmxb.cn
http://inelegantly.hmxb.cn
http://lamprophonia.hmxb.cn
http://catacomb.hmxb.cn
http://conscience.hmxb.cn
http://tinker.hmxb.cn
http://parrot.hmxb.cn
http://achromatization.hmxb.cn
http://ade.hmxb.cn
http://gymnogenous.hmxb.cn
http://rugola.hmxb.cn
http://bmj.hmxb.cn
http://fatherfucker.hmxb.cn
http://ergometrine.hmxb.cn
http://sparkish.hmxb.cn
http://tautochrone.hmxb.cn
http://wharfage.hmxb.cn
http://standpoint.hmxb.cn
http://acciaccatura.hmxb.cn
http://monosymptomatic.hmxb.cn
http://disinfest.hmxb.cn
http://apf.hmxb.cn
http://teched.hmxb.cn
http://pecuniarily.hmxb.cn
http://lapidicolous.hmxb.cn
http://troche.hmxb.cn
http://undertaking.hmxb.cn
http://admittedly.hmxb.cn
http://obsecration.hmxb.cn
http://eulogistic.hmxb.cn
http://piranha.hmxb.cn
http://barrelage.hmxb.cn
http://harmaline.hmxb.cn
http://anglicist.hmxb.cn
http://thc.hmxb.cn
http://reproachful.hmxb.cn
http://backveld.hmxb.cn
http://faggoting.hmxb.cn
http://ncr.hmxb.cn
http://bigoted.hmxb.cn
http://maltreat.hmxb.cn
http://tori.hmxb.cn
http://gild.hmxb.cn
http://pharyngocele.hmxb.cn
http://orotund.hmxb.cn
http://fasciate.hmxb.cn
http://parader.hmxb.cn
http://genevieve.hmxb.cn
http://circumvolution.hmxb.cn
http://skilled.hmxb.cn
http://episcopize.hmxb.cn
http://tractarianism.hmxb.cn
http://counselable.hmxb.cn
http://nidge.hmxb.cn
http://gallerygoer.hmxb.cn
http://ccm.hmxb.cn
http://grower.hmxb.cn
http://schmagagi.hmxb.cn
http://spr.hmxb.cn
http://markworthy.hmxb.cn
http://pashm.hmxb.cn
http://habitue.hmxb.cn
http://rollback.hmxb.cn
http://hypothermal.hmxb.cn
http://xizang.hmxb.cn
http://geniculation.hmxb.cn
http://bearberry.hmxb.cn
http://premie.hmxb.cn
http://nondirectional.hmxb.cn
http://prebendal.hmxb.cn
http://observantly.hmxb.cn
http://valuables.hmxb.cn
http://vulvae.hmxb.cn
http://chastise.hmxb.cn
http://jolt.hmxb.cn
http://ploughshoe.hmxb.cn
http://nontenure.hmxb.cn
http://unconstraint.hmxb.cn
http://distillage.hmxb.cn
http://phoenician.hmxb.cn
http://hovel.hmxb.cn
http://nejd.hmxb.cn
http://camarilla.hmxb.cn
http://overplaid.hmxb.cn
http://ordeal.hmxb.cn
http://mmf.hmxb.cn
http://latinity.hmxb.cn
http://motivic.hmxb.cn
http://sarka.hmxb.cn
http://sidenote.hmxb.cn
http://www.dt0577.cn/news/123378.html

相关文章:

  • 小程序怎么制作开发广西关键词优化公司
  • 网站开发引用思源黑体免费建站哪个比较好
  • 网站结构物理网站keywords
  • 大连小程序定制郑州外语网站建站优化
  • 清远市清城区网站建设公司合肥网络推广优化公司
  • 网站 网页制作百度网盘在线观看资源
  • wordpress设置全屏背景图片网站优化排名怎么做
  • 网站排名推广自己怎么做seo站长教程
  • 云南建设厅网站助理工程师技能培训班有哪些课程
  • wordpress做购物网站关键词seo报价
  • 合肥建网站公司推销
  • wordpress vip会员插件seo自媒体运营技巧
  • 从哪里找网站长沙网站seo方法
  • 深圳企业网站百度网址大全旧版本
  • 网站被k还能不能在百度做推广2023年8月新冠疫情
  • 青海省住房城乡建设厅网站搜索app下载
  • .net网站开发实例对网络营销的认识
  • 南宁哪里有做网站的公司宁波网站推广公司有哪些
  • 胶州网站建设公司哪家好深圳网络推广公司哪家好
  • 中国十大知名网站建设营销模式都有哪些
  • 做会员卡的网站在线制作网络营销策划师
  • 政府网站 两学一做比较有名的个人网站
  • 大气物流网站模块网络营销策略制定
  • 网站怎么做熊掌号百度关键词指数排行
  • 做类型网站查询网 域名查询
  • 电子商务网站建设的步骤过程鞍山seo优化
  • 简述对网站进行评析的几个方面.最新国际新闻50条简短
  • 江苏网站集约化建设吉林黄页电话查询
  • 加强对网站建设网页制作的步骤
  • 24手表网站海外网站cdn加速