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

东莞网站设计绿色建筑信息平台

东莞网站设计,绿色建筑信息平台,中文wordpress企业,太原网站开发哪家好再接入nacos配置中心时#xff0c;需要确认几点#xff1a; 1. spring boot 版本 (spring boot 2.x ) 2. nacos 配置中心 服务端 版本 (1.1.4) 3. nacos client 客户端版本 (1.1.4) 方式一 1. 启动 nacos 服务端#xff0c;这里不做解释 在配置中心中加入几个配置 2. 在…再接入nacos配置中心时需要确认几点 1. spring boot 版本 (spring boot 2.x ) 2. nacos 配置中心 服务端 版本 (1.1.4) 3. nacos client 客户端版本 (1.1.4) 方式一 1. 启动 nacos 服务端这里不做解释 在配置中心中加入几个配置 2. 在自己的应用里引入 依赖包 dependencygroupIdcom.alibaba.boot/groupIdartifactIdnacos-config-spring-boot-starter/artifactIdversion0.2.8/version/dependency 注意 nacos-config-spring-boot-starter 的版本内 引入了 nacos-client需要注意引入的版本 是否与nacos服务端匹配。如果不匹配可能会有问题。 这里使用的 nacos 服务端 是 1.x版本所有引入的包也是1.x的才可以。 3. 配置 nacos 服务端地址 nacos.config.server-addr localhost:8848  4.  在spring boot 启动类 加入 注解 如果是 只有一个 dataId使用 NacosPropertySource 如果有 多个 dataId使用 NacosPropertySources SpringBootApplication NacosPropertySources({NacosPropertySource(dataId springboot-nacos-hello, autoRefreshed true,type ConfigType.PROPERTIES),NacosPropertySource(dataId useLocalCache, autoRefreshed true,type ConfigType.PROPERTIES) }) public class NacostestApplication {public static void main(String[] args) {SpringApplication.run(NacostestApplication.class, args);}} 5. 读取 配置 使用 注解 NacosValue NacosValue(value ${hi}, autoRefreshed true)private String useLocalCache; 方式二 引入依赖 dependencygroupIdcom.alibaba.nacos/groupIdartifactIdnacos-client/artifactIdversion1.1.4/version/dependency 直接调用api Component public class ConfigS {Beanpublic ConfigService configService() {try {Properties properties new Properties();properties.setProperty(serverAddr, localhost:8848);ConfigService configService NacosFactory.createConfigService(properties);configService.addListener(springboot-nacos-hello, DEFAULT_GROUP, new Listener() {Overridepublic Executor getExecutor() {return null;}Overridepublic void receiveConfigInfo(String configInfo) {// 配置更新处理逻辑System.out.printf(configInfo);}});return configService;} catch (Exception e) {return null;}} } configService.getConfig(springboot-nacos-hello,DEFAULT_GROUP,10000) 这种方式 只是简单的拉去配置中心的内容需要自己解析 配置内容和监听更新 方案三 引入依赖包 dependencygroupIdcom.alibaba.cloud/groupIdartifactIdspring-cloud-starter-alibaba-nacos-config/artifactIdversion2.1.1.RELEASE/versionexclusionsexclusiongroupIdcom.alibaba.nacos/groupIdartifactIdnacos-client/artifactId/exclusion/exclusions/dependencydependencygroupIdcom.alibaba.nacos/groupIdartifactIdnacos-client/artifactIdversion1.1.4/version/dependency 在 bootstrap.properties 文件中配置属性 #服务地址 spring.cloud.nacos.config.server-addr localhost:8848#共享配置 spring.cloud.nacos.config.shared-dataidsa.properties,b.properties spring.cloud.nacos.config.refreshable-dataidsa.properties#扩展配置 spring.cloud.nacos.config.ext-config.0.data-iduseLocalCache.properties spring.cloud.nacos.config.ext-config.0.refreshtrue spring.cloud.nacos.config.ext-config.1.data-iduseLocalCache2.properties#当前应用 spring.cloud.nacos.config.prefixapp spring.cloud.nacos.config.file-extension properties 读取配置 使用Value 注解 Value(value ${hi}) private String useLocalCache;   nacos配置中心添加配置 共有三种配置 1. 加载共享配置 sharedDataids 注意 需要有后缀 refreshableDataids 分隔符 [,] 2. 加载扩展配置 extConfig 数组结构 dataId 必须有后缀 3. 加载应用级别的配置 读取 prefix /name/spring.application.name 属性 作为dataId 1. 直接加载 dataId 2. 加载 dataId.fileExtension 3. 加载 dataId - profile . fileExtension 覆盖
http://www.pierceye.com/news/776655/

相关文章:

  • 如何做网站卖东西长春互联网公司排名
  • 怎样拥有自己的网站制作网站的步骤和方法
  • 北京电子商务app网站建设大兴小程序源码如何部署到服务器
  • 设计找图网站网站用什么构建
  • 做微信的网站叫什么软件湛江网站建设制作维护
  • 做网站商城多少钱wordpress链接公众号
  • 数码产品销售网站建设策划书金融类网站模板
  • 档案网站建设视频网络软营销的案例
  • 德州市建设局质监站网站织梦做的网站打包在dw修改
  • 做那个男女的视频网站湖南响应式网站公司
  • 1个ip可以做几个网站电商网站建设阿里云
  • 网站做seo需要些什么wordpress虎嗅破解版
  • 网站开发按钮图片素材巩义自助建站优化
  • 石家庄网站建设接单常见的网络直接营销有哪些
  • 上海网站建设技术托管找合伙人做网站
  • 网站和自媒体都可以做东莞专业营销网站建设推广
  • 毕业设计网站怎么做校园网二手书交易网站建设
  • 网站运营托管协议凡科建设网站还用买服务器吗
  • 黑龙江省建设网官方网站erp系统软件免费版
  • 网站建设案例算命网站百度搜索站长平台网站
  • 手机wap网站模板 带后台thefox wordpress
  • 公司网站建设与设计制作游戏网站的设计方案
  • 移动端网站设计规范程序员帮忙做放贷网站
  • 网站到期查询广西建设信息网
  • 服务器可以放几个网站市场调研的五个步骤
  • 网站前置审批h5页面制作软件thinkphp
  • 企业网站设计调查问卷步骤记录器
  • dw里响应式网站怎么做郑州电力高等专科学校学费多少
  • 用app怎么样建网站深圳专业做网站的
  • 怎样做浏览的网站不被发现互联网营销师报考条件