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

网站建设标准社群营销的十大步骤

网站建设标准,社群营销的十大步骤,网站建设经,鞍山做网站的文章目录 响应头添加版本号获取版本号添加响应处理器请求结果 打包项目后缀添加版本号和时间实现打包结果 响应头添加版本号 获取版本号 在 pom.xml 中,在 project.version 下定义版本号 在 application.yml 获取 pom.xml 中 project.version 中的信息 添加响应处…

文章目录

  • 响应头添加版本号
    • 获取版本号
    • 添加响应处理器
    • 请求结果
  • 打包项目后缀添加版本号和时间
    • 实现
    • 打包结果


响应头添加版本号

获取版本号

pom.xml 中,在 project.version 下定义版本号

在这里插入图片描述

application.yml 获取 pom.xmlproject.version 中的信息

在这里插入图片描述

添加响应处理器

完整代码如下:

通过 @Value("${project.version}") 获取 application.yml 中的 project.version,并写入响应头

import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;@ControllerAdvice
public class GlobalResponseBodyHandler implements ResponseBodyAdvice<Object> {@Value("${project.version}")private String version;@Overridepublic boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {return true;}@Overridepublic Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {ServletServerHttpResponse ssResp = (ServletServerHttpResponse) response;HttpServletResponse resp = ssResp.getServletResponse();resp.setHeader("version", StringUtils.isNotEmpty(version) ? version : "unknown");return body;}
}

请求结果

在这里插入图片描述

打包项目后缀添加版本号和时间

实现

pom.xml 中的 build 标签,写入以下代码

<build><!--打包后生成文件名--><finalName>${project.artifactId}-${project.version}_${current.time}</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>com.chh.api.ChhApplication</mainClass><executable>true</executable></configuration></plugin><plugin><groupId>org.codehaus.mojo</groupId><artifactId>build-helper-maven-plugin</artifactId><version>3.0.0</version><executions><execution><id>timestamp-property</id><goals><goal>timestamp-property</goal></goals></execution></executions><configuration><name>current.time</name><pattern>yyyyMMdd-HHmmss</pattern><timeZone>GMT+8</timeZone></configuration></plugin><!-- 打包跳过测试--><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><configuration><skip>true</skip></configuration></plugin></plugins>
</build>

打包结果

在这里插入图片描述

http://www.yidumall.com/news/80111.html

相关文章:

  • 全屏网站制作百度自然排名优化
  • 成都企业做网站多少钱友链价格
  • 重庆做网站职业技术培训机构
  • 漳州最专业的网站建设公司在哪里可以免费自学seo课程
  • 湘潭建设路街道网站上海网络推广公司排名
  • 丰台网站建设怎样优化关键词到首页
  • 门户网站制作费用北京百度推广代理
  • 智能建站网站网站快速建站
  • wordpress添加备案号优化怎么做
  • 网络营销工具的定义seo排名助手
  • 南充房产网官网seo软件推广
  • 国内产品网站w源码1688百度网站优化培训
  • 高校网站建设的优势和不足抖音seo排名系统
  • 网站备案信息怎么做企业培训课程有哪些
  • 织梦网站图标路径广东深圳龙华区
  • o2o商城网站建设供应游戏推广合作平台
  • 阿里云香港节点做的网站排名优化服务
  • 毕节网站建设与对策分析个人博客网站设计毕业论文
  • 贵州省住房和城乡建设厅网站打不开免费b2b推广网站大全
  • 锦州滨海新区城市建设规划网站女生做sem还是seo
  • 昌乐哪里有做网站的百度权重是怎么来的
  • 南京医院网站建设上海百度
  • 提供b2c电商网站开发微信裂变营销软件
  • 怎样做微课网站站外推广免费网站
  • 哪个网站网页做的好看百度购物平台客服电话
  • 做教育网站的er图最新国际新闻 大事件
  • 怎么给网站做谷歌seopc网站建设和推广
  • 网站建设会员管理系统方案网络推广运营是做什么
  • b2c类型的网站seo是哪个英文的简写
  • 外包网站建设企业网站推广方案设计毕业设计