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

泉州做企业网站wordpress全图水印

泉州做企业网站,wordpress全图水印,做黄金的经常看什么网站,免费网站建设下载再接入nacos配置中心时,需要确认几点: 1. spring boot 版本 (spring boot 2.x ) 2. nacos 配置中心 服务端 版本 (1.1.4) 3. nacos client 客户端版本 (1.1.4) 方式一 1. 启动 nacos 服务端,这里不做解释 在配置中心中加入几个配置 2. 在…

再接入nacos配置中心时,需要确认几点:

1. spring boot 版本 (spring boot 2.x )

2. nacos 配置中心 服务端 版本 (1.1.4)

3. nacos client 客户端版本 (1.1.4)

方式一

1. 启动 nacos 服务端,这里不做解释

在配置中心中加入几个配置

2. 在自己的应用里引入 依赖包

<dependency><groupId>com.alibaba.boot</groupId><artifactId>nacos-config-spring-boot-starter</artifactId><version>0.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;

方式二:

引入依赖

        <dependency><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId><version>1.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)

这种方式 只是简单的拉去配置中心的内容,需要自己解析 配置内容和监听更新

方案三

引入依赖包

        <dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId><version>2.1.1.RELEASE</version><exclusions><exclusion><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId></exclusion></exclusions></dependency><dependency><groupId>com.alibaba.nacos</groupId><artifactId>nacos-client</artifactId><version>1.1.4</version></dependency>

 在 bootstrap.properties 文件中配置属性:

#服务地址
spring.cloud.nacos.config.server-addr= localhost:8848#共享配置
spring.cloud.nacos.config.shared-dataids=a.properties,b.properties
spring.cloud.nacos.config.refreshable-dataids=a.properties#扩展配置
spring.cloud.nacos.config.ext-config.0.data-id=useLocalCache.properties
spring.cloud.nacos.config.ext-config.0.refresh=true
spring.cloud.nacos.config.ext-config.1.data-id=useLocalCache2.properties#当前应用
spring.cloud.nacos.config.prefix=app
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.yayakq.cn/news/201310/

相关文章:

  • 郑州做网站建设公司哪家好空间网站模板
  • 简述网站开发的三层架构分享惠网站怎么做
  • 万户网站协作管理系统疯狂大叔 wordpress
  • 免费网站后台管理系统html推广普通话作文500字
  • wordpress多站点模式插件重庆市建设厅官方网站
  • 网站建设有哪些技术沈阳企业网站设计制作
  • 做神马网站优化快梅江区建设局网站
  • 网站建设相关参考资料国内专业的seo机构
  • 白云品牌型网站建设无锡微信网站建设价格
  • 网站水军怎么做怎么做网页链接文章
  • 济南网站建设正规公司哪家好公司常用邮箱
  • 网站制作有前途吗seo关键词优化的技巧和方法
  • 别人做的网站需要提供些什么给我们wordpress 编辑器漏洞
  • 编辑网站用什么软件html代码特效
  • 云南网站建设找三好科技页面设计上边距在哪里找
  • 网站建设考试题wordpress移动主题now
  • 站长工具亚洲网站推广最有效的方法
  • 网络营销网站功能初级网络工程师需要学哪些
  • 旅游景区英文网站建设研究河南新闻最新消息10条
  • 宝应县建设工程管理局网站金坛网站建设
  • 网站建设学习网站石家庄造价信息网
  • 访问国外网站dns网站需要备案才能建设吗
  • wordpress 缓存头像广东seo推广费用
  • 招聘网站建设的项目描述链接怎么做
  • ipad 网站开发工具中国人做的比较好的shopify网站
  • 做特价的网站百度wordpress被刷搜索
  • 京东这样的网站怎么做wordpress 开发 电商
  • 网站建设公司怎么赚钱网络推广网站建设方案
  • 平台网站360指数查询
  • 网站设计深圳联系电话?wordpress 主题安装 时间