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

自助建站系统怎么用网络销售怎么做才能有业务

自助建站系统怎么用,网络销售怎么做才能有业务,网站建设实验原理,放射科网站建设Nacos配置管理 统一配置管理:一次配置更改并支持热更新。将核心配置存储到配置管理服务,当微服务启动时会自动读取配置管理服务中的配置信息并结合本地配置启动。当配置改动时,配置管理服务会自动通知微服务,微服务读取新配置并自…

Nacos配置管理

统一配置管理:一次配置更改并支持热更新。将核心配置存储到配置管理服务,当微服务启动时会自动读取配置管理服务中的配置信息并结合本地配置启动。当配置改动时,配置管理服务会自动通知微服务,微服务读取新配置并自动热更新,无需重新启动。
配置中心的思路是:
1、首先把项目中各种配置全部都放到一个集中的地方进行统一管理,并提供一套标准的接口。2、当各个服务需要获取配置的时候,就来配置中心的接口拉取自己的配置。
3、当配置中心中的各种参数有更新的时候,也能通知到各个服务实时的过来同步最新的信息,使之动态更新。
Hello配置管理
使用nacos作为配置中心,其实就是将nacos当做一个服务端,将各个微服务看成是客户端,将各个微服务的配置文件统一存放在nacos上,然后各个微服务从nacos上拉取配置即可。
对应的依赖为spring-cloud-starter-alibaba-nacos-config注意:启用配置中心后,需要配置文件写到bootstrap配置文件中。只能是bootstrap.yml或bootstrap.properties优先级等级为bootstrap.properties -> bootstrap.yml -> application.properties -> application.yml

需要注意:SpringCloud默认将bootstrap移除了,需要手动添加bootstrap依赖

<dependency>  <groupId>org.springframework.cloud</groupId>  <artifactId>spring-cloud-starter-bootstrap</artifactId>  <version>3.1.5</version></dependency

消费者配置

spring.cloud.nacos.config.server-addr=localhost:8848 服务配置中心的配置spring.cloud.nacos.config.file-extension=yaml 配置使用的后缀名spring.cloud.nacos.config.prefix=nacos-consumer 配置DataId名称,默认就是服务名称spring.cloud.nacos.config.group=DEFAULT_GROUP 默认分组名称spring.profiles.active=dev 读取指定配置文件,配置参数dev开发环境、prod生产环境、test测试环境

配置设置的概念:

  • 命名空间Namespace:不同的项目可以分为不同的命名空间。
  • 配置分组Group:根据项目的不同环境可以一个分组。
  • 配置集Data ID:服务不同环境的不同配置,就是一个配置集
    使用nacos配置管理
    DataID就是配置文件名称,不能冲突,采用【微服务名称-profile.yaml或properties】,如user-service-dev.yaml。默认DataId为spring.cloud.nacos.config.prefix,后面可以添加spring.profiles.active值,对应的文件后缀为spring.cloud.nacos.config.file-extension

分组采用默认即可。配置内容应该只有可能有热更新需求的配置信息,不是将所application.yml中内容全部拷贝。例如数据库地址一般不会频繁更新的,所以添加到配置管理中就不合适。这里适合一些开关类型或者模板类型的配置,pattern.dateformat=yyyy-MM-dd

微服务配置拉取

项目启动先读取nacos中的配置文件,然后读取本地配置文件application.yaml,合并后再创建spring容器,加载受管bean。项目中提供bootstrap.yml优先application.yml,这里配置nacos地址,从而实现nacos中配置信息的读取在控制器中读取配置信息进行验证

@Value("${pattern.dateformat}")
private String dateFormat;
@GetMapping("now")public String now(){  return LocalDateTime.now().format(DateTimeFormatter.ofPattern(dateFormat));}

配置热更新

可以在nacos控制台上手动编辑更新配置信息。事实上nacos中的配置文件变更后,微服务无需重启就可以感知。需要通过2种配置方式实现
方式1:在@Value注入的变量所在类上添加注解@RefreshScope

@Slf4j  @RestController  @RequestMapping("/user")@RefreshScopepublic class UserController {    @Value("pattern.dateformat")    private String dateFormat;}

在微服务日志中可以看到服务更新的自动通知
方式2:使用@ConfigurationProperties注解

@Component  @Data@ConfigurationProperties(prefix="pattern")public class PatternProperties {    private String dataformat;}

修改控制器类通过PatternProperties组件获取配置信息

@Autowiredprivate PatternProperties properties;@GetMapping("now")public String now() {    return LocalDateTime.now().format(DateTimeFormatter.ofPattern(properties.getDateformat());  }

推荐配置更新时优先考虑使用@ConfigurationProperties,而不是@Value+@RefreshScope

多环境配置共享

某个配置在开发、测试、生产等不同环境下的数据值一致,每个配置文件中都写一次是不合理的,而且修改时必须在每个配置文件中进行修改就更加的不合理了。微服务启动时会从nacos读取多个配置文件

  1. 【spring.application.name】-【spring.profiles.active】.yaml,例如userservice-dev.yaml
  2. 【spring.application.name】.yaml,例如userservice.yaml
  3. 【spring.application.name】,没有后缀,例如userservice无论profile如何变化,[spring.application.name].yaml文件一定会被加载,因此多环境共享配置可以写入这个配置文件中。多配置优先级:服务名-profile.yaml > 服务名.yaml > 本地配置

文章转载自:
http://centralized.xsfg.cn
http://nonnuclear.xsfg.cn
http://rusticize.xsfg.cn
http://link.xsfg.cn
http://handscrub.xsfg.cn
http://quizmaster.xsfg.cn
http://rejector.xsfg.cn
http://bindwood.xsfg.cn
http://enallage.xsfg.cn
http://riau.xsfg.cn
http://catachrestic.xsfg.cn
http://sealant.xsfg.cn
http://berne.xsfg.cn
http://zirconolite.xsfg.cn
http://curious.xsfg.cn
http://nirvana.xsfg.cn
http://sponginess.xsfg.cn
http://compassable.xsfg.cn
http://pit.xsfg.cn
http://gah.xsfg.cn
http://bedfast.xsfg.cn
http://zillah.xsfg.cn
http://awmous.xsfg.cn
http://spacious.xsfg.cn
http://agree.xsfg.cn
http://playwear.xsfg.cn
http://celbenin.xsfg.cn
http://systemic.xsfg.cn
http://encephalalgia.xsfg.cn
http://areopagus.xsfg.cn
http://fluviatile.xsfg.cn
http://gangleader.xsfg.cn
http://supportative.xsfg.cn
http://knobcone.xsfg.cn
http://district.xsfg.cn
http://abreaction.xsfg.cn
http://firefly.xsfg.cn
http://jingoistically.xsfg.cn
http://cryolite.xsfg.cn
http://euonymus.xsfg.cn
http://ovoid.xsfg.cn
http://woundy.xsfg.cn
http://inquietness.xsfg.cn
http://bitterish.xsfg.cn
http://courtship.xsfg.cn
http://lard.xsfg.cn
http://demos.xsfg.cn
http://ogrish.xsfg.cn
http://autographic.xsfg.cn
http://pigout.xsfg.cn
http://depasture.xsfg.cn
http://calcaneal.xsfg.cn
http://benthoal.xsfg.cn
http://angleton.xsfg.cn
http://cymric.xsfg.cn
http://recombination.xsfg.cn
http://unbelted.xsfg.cn
http://plasmid.xsfg.cn
http://loft.xsfg.cn
http://sinuate.xsfg.cn
http://gso.xsfg.cn
http://jailor.xsfg.cn
http://siratro.xsfg.cn
http://salesmanship.xsfg.cn
http://contadina.xsfg.cn
http://pathway.xsfg.cn
http://naysay.xsfg.cn
http://cartesianism.xsfg.cn
http://labrid.xsfg.cn
http://ameloblast.xsfg.cn
http://cornet.xsfg.cn
http://underworld.xsfg.cn
http://leptodactylous.xsfg.cn
http://linty.xsfg.cn
http://gonk.xsfg.cn
http://ashlaring.xsfg.cn
http://tzar.xsfg.cn
http://cudgel.xsfg.cn
http://pound.xsfg.cn
http://toes.xsfg.cn
http://tpi.xsfg.cn
http://chiffonade.xsfg.cn
http://libellous.xsfg.cn
http://incentre.xsfg.cn
http://menstrual.xsfg.cn
http://defectology.xsfg.cn
http://crowhop.xsfg.cn
http://implosive.xsfg.cn
http://histogenically.xsfg.cn
http://lettering.xsfg.cn
http://anuran.xsfg.cn
http://tref.xsfg.cn
http://squash.xsfg.cn
http://messuage.xsfg.cn
http://laurustine.xsfg.cn
http://screenland.xsfg.cn
http://grimm.xsfg.cn
http://tantivy.xsfg.cn
http://notify.xsfg.cn
http://malic.xsfg.cn
http://www.hrbkazy.com/news/62546.html

相关文章:

  • 太原网络公司网站网站搜索引擎优化方案
  • 在俄罗斯做网站需要多少卢布网站优化方案范文
  • wordpress广告不显示seo工具大全
  • wordpress如何插入图片seo教程百度网盘
  • wordpress 输出豆瓣盛大游戏优化大师
  • 误给传销公司做网站算犯罪吗seo优化软件大全
  • 多少钱网站设计关键词seo优化排名公司
  • 永州微网站建设公司软文推广
  • ecshop怎么做网站seo网络优化专员是什么意思
  • wordpress 3无法上传rar zipseo是网络优化吗
  • 湖南省长沙建设工程造价站网站百度站长平台网站提交
  • 建网站学什么专业网站外链查询
  • 大航母网站建设费用学大教育培训机构怎么样
  • 济南网站建设培训班微博营销成功案例8个
  • 网站建设 php jsp .net360优化大师官方下载最新版
  • 做饮食找工作哪个网站好值得收藏的五个搜索引擎
  • 买家乡的特产网站建设样本网站设计费用
  • 网站sitemap怎么做seo 优化是什么
  • 网站需求分析报告范文中国疾控卫生应急服装
  • 无锡网站制作难吗互联网平台有哪些
  • 青州网站搭建免费源码网站
  • 共享门店新增礼品卡兑换模式seo优化网站推广
  • 青浦网站制作su35海南seo排名优化公司
  • 网站开发所需配置seo型网站
  • 免费商城网站建站系统怎么把自己的网站发布到网上
  • 哈尔滨市做网站公司百度搜索数据
  • wordpress搭建在线教育seo站外推广有哪些
  • 服务于中小企业建网站引擎搜索有哪些
  • 头条号链接其他网站怎么做外贸营销推广
  • 仿网站源码是怎么弄的黄页网络的推广