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

如何在手机做网站独立站seo

如何在手机做网站,独立站seo,软件定制化开发,昆明展示型网站开发问题描述 在使用 Apollo Client 1.6.0 结合 Spring Cloud 的 RefreshScope 和 Value 注解时,遇到以下问题: 项目启动时第一次属性注入成功后续配置变更时,Value 属性会刷新,但总是刷新为第一次的旧值,而不是最新的配…

问题描述

在使用 Apollo Client 1.6.0 结合 Spring Cloud 的 @RefreshScope 和 @Value 注解时,遇到以下问题:

  • 项目启动时第一次属性注入成功
  • 后续配置变更时,@Value 属性会刷新,但总是刷新为第一次的旧值,而不是最新的配置值
<dependency><groupId>com.ctrip.framework.apollo</groupId><artifactId>apollo-client</artifactId><version>1.6.0</version>
</dependency>

问题本质深度解构

解决方案

apollo客户端升级到2.1.0

<dependency><groupId>com.ctrip.framework.apollo</groupId><artifactId>apollo-client</artifactId><version>2.1.0</version>
</dependency>

自定监听

import com.ctrip.framework.apollo.model.ConfigChange;
import com.ctrip.framework.apollo.model.ConfigChangeEvent;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
import org.springframework.cloud.context.scope.refresh.RefreshScope;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;@Component
@Slf4j
public class ApolloChangeListener implements ApplicationContextAware {private final RefreshScope refreshScope;private ApplicationContext applicationContext;public ApolloChangeListener(RefreshScope refreshScope) {this.refreshScope = refreshScope;}/*** 实时监听配置修改,并对修改项进行处理** @param changeEvent 配置修改事件(其中包含修改信息)*/@ApolloConfigChangeListener("${apollo.bootstrap.namespaces}")private void configChangeHandler(ConfigChangeEvent changeEvent) {log.info("================Apollo auto refresh start===========================");for (String changedKey : changeEvent.changedKeys()) {ConfigChange configChange = changeEvent.getChange(changedKey);String oldValue = configChange.getOldValue();String newValue = configChange.getNewValue();log.info("changedKey:{},oldValue:{}, newValue:{}", changedKey, oldValue, newValue);}refreshContext(changeEvent);log.info("================Apollo auto refresh end===========================");}/*** 跟进配置修改刷新上下文内容** @param changeEvent 配置修改事件(其中包含修改信息)*/public void refreshContext(ConfigChangeEvent changeEvent) {this.applicationContext.publishEvent(new EnvironmentChangeEvent(changeEvent.changedKeys()));refreshScope.refreshAll();}@Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {this.applicationContext = applicationContext;}
}
http://www.dtcms.com/wzjs/347393.html

相关文章:

  • 网站建设开发步骤seo品牌优化整站优化
  • 什么网站可以做饼图百度搜索风云榜下载
  • 2018做网站开发一个月工资多少网络营销策划书5000字
  • 赣州新闻网seo案例视频教程
  • 做儿童方面的网站营销渠道名词解释
  • 广东手机微信网站制作无锡网站建设方案优化
  • 自己做简单网站价格杭州seo网站优化
  • 日本做头像的网站可以免费打广告的网站
  • 徐州有哪些制作网站的公司网站快速排名
  • 柳州网站建设柳州深圳媒体网络推广有哪些
  • 山西省国贸网站建设互联网广告投放平台加盟
  • 中型电商网站维护费用网站排名优化制作
  • 可以做外链的网站平台银徽seo
  • 上海网站建设机构专业搜索引擎seo合作
  • 中国五大网站建设公司百度小说风云排行榜
  • 昆明微网站中国职业培训在线官方网站
  • 网站开发学什么语言seo优化培训
  • 一学一做短视频网站网站权重怎么提高
  • 山东省住房和城乡建设厅二级建造师宁波seo外包推广
  • 跑步机网站建设思维导图河南网站定制
  • 沁阳网站建设百度关键词优化多少钱一年
  • 怎样做旅游摄影网站郑州怎么优化网站排名靠前
  • 建筑工程网格化管理实施方案2024最新版seo搜索引擎优化方案
  • 安徽省建设厅网站 职称微商引流被加方法精准客源
  • 网站公司未来计划ppt怎么做广州软文推广公司
  • 做网站端口无法清除现在的seo1发布页在哪里
  • 公司网站内容更新该怎么做餐饮营销案例100例
  • 营销型网站建设 案例seo快速排名利器
  • 微信网站建设模板百度seo系统
  • 广州市 网站 建设济南做网站比较好的公司