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

进入qq空间登录西安官网seo技术

进入qq空间登录,西安官网seo技术,网页游戏网址有哪些,专业的网站建设案例一、介绍 (1)服务注册中心 (2)管理各个服务上的application.yml,支持动态修改,但不会影响客户端配置 (3)一般将application.yml文件放在git上,客户端通过http/https方式…

一、介绍

(1)服务注册中心
(2)管理各个服务上的application.yml,支持动态修改,但不会影响客户端配置
(3)一般将application.yml文件放在git上,客户端通过http/https方式拉取

二、项目搭建

(1)建个远程仓库,创建两个配置文件application.yml
在这里插入图片描述
(2)编写pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>demo20220821</artifactId><groupId>com.wsh.springcloud</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>cloud-config-config3344</artifactId><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><dependency><groupId>com.wsh.springcloud</groupId><artifactId>cloud-api-common</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies>
</project>

(3)编写application.yml文件

server:port: 3344spring:application:name: cloud-config-servicecloud:config:server:git:uri: https://gitee.com/xxx/config.gitlabel: mastereureka:client:#    客户端设置为trueregister-with-eureka: true#    客户端设置为truefetch-registry: trueservice-url:#      defaultZone: http://localhost:7001/eurekadefaultZone: http://eureka1.com:7001/eureka, http://eureka2.com:7002/eurekainstance:instance-id: config3344prefer-ip-address: true

(4)编写启动类

package com.wsh.springcloud;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;/*** @ClassName ConfigMain3344* @Description: TODO* @Author wshaha* @Date 2023/10/15* @Version V1.0**/
@SpringBootApplication
@EnableEurekaClient
@EnableConfigServer
public class ConfigMain3344 {public static void main(String[] args) {SpringApplication.run(ConfigMain3344.class, args);}
}

(5)运行
在这里插入图片描述

三、客户端读取

(1)application.yml是用户级的,bootstrap.yml是系统级的,优先级更高
(2)编写pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>demo20220821</artifactId><groupId>com.wsh.springcloud</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>cloud-config-client3355</artifactId><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><dependency><groupId>com.wsh.springcloud</groupId><artifactId>cloud-api-common</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies>
</project>

(3)编写bootstrap.yml

server:port: 3355spring:application:name: cloud-config-client-servicecloud:config:label: master #分支名name: application # - 号前缀profile: prod # - 号后缀uri: http://localhost:3344 #配置中心地址eureka:client:#    客户端设置为trueregister-with-eureka: true#    客户端设置为truefetch-registry: trueservice-url:#      defaultZone: http://localhost:7001/eurekadefaultZone: http://eureka1.com:7001/eureka, http://eureka2.com:7002/eurekainstance:instance-id: configClient3355prefer-ip-address: true

(4)编写启动类

package com.wsh.springcloud;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;/*** @ClassName ConfigMain3344* @Description: TODO* @Author wshaha* @Date 2023/10/15* @Version V1.0**/
@SpringBootApplication
@EnableEurekaClient
public class ConfigClientMain3355{public static void main(String[] args) {SpringApplication.run(ConfigClientMain3355.class, args);}
}

(5)编写Controller

package com.wsh.springcloud.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;/*** @ClassName ConfigClientController* @Description: TODO* @Author wshaha* @Date 2023/10/15* @Version V1.0**/
@RestController
public class ConfigClientController {@Value("${teset.name}")private String name;@RequestMapping("/getConfig")public String getConfig(){return name;}
}

(6)运行
在这里插入图片描述

四、手动刷新客户端配置

(1)暴露actuator

server:port: 3355spring:application:name: cloud-config-client-servicecloud:config:label: master #分支名name: application # - 号前缀profile: prod # - 号后缀uri: http://localhost:3344 #配置中心地址eureka:client:#    客户端设置为trueregister-with-eureka: true#    客户端设置为truefetch-registry: trueservice-url:#      defaultZone: http://localhost:7001/eurekadefaultZone: http://eureka1.com:7001/eureka, http://eureka2.com:7002/eurekainstance:instance-id: configClient3355prefer-ip-address: truemanagement:endpoints:web:exposure:include: "*"

(2)Controller增加注解@RefreshScope

package com.wsh.springcloud.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;/*** @ClassName ConfigClientController* @Description: TODO* @Author wshaha* @Date 2023/10/15* @Version V1.0**/
@RestController
@RefreshScope
public class ConfigClientController {@Value("${teset.name}")private String name;@RequestMapping("/getConfig")public String getConfig(){return name;}
}

(3)执行命令,必须是POST请求

curl -X POST "http://localhost:3355/actuator/refresh"
http://www.yidumall.com/news/28650.html

相关文章:

  • 企业网站联系我们营销渠道管理
  • 做国外有那些网站百度指数上多少就算热词
  • 品牌网站建站目的关键词优化排名怎么做
  • 网站主机查询关键词优化哪个好
  • 网站后台管理系统 模板什么是网络推广员
  • 专业做轴承的网站搜索优化的培训免费咨询
  • 软件开发详细设计文档百度seo收费
  • 投诉网站怎么做宁波百度快照优化排名
  • 网站建设方案报价网站seo基础优化
  • 通讯设备 技术支持 东莞网站建设google play 安卓下载
  • 做电商到底如何赚钱aso优化软件
  • 重庆网站建设首选承越黄冈网站推广软件免费下载
  • 学校网站建设教程搜索引擎优化的主要特征
  • 商业网站怎么做阿里指数数据分析平台官网
  • 网站推广指标包括南宁seo外包平台
  • 做情书直接点网站seo引擎优化平台培训
  • 深圳网站建设科技有限公司制作网站的软件有哪些
  • 做盗版电影网站违法吗今天发生的重大新闻
  • 网站建设福建百度大数据预测平台
  • seo是什么时候开始的seo分析
  • 企业站用什么程序做网站qq推广软件
  • 阜蒙县建设镇网站网络营销策划名词解释
  • 怎么样做淘宝联盟网站图片搜索
  • 258做网站靠谱么企业网站推广
  • 自己电脑怎么做网站服务器吗申请自己的网站
  • 怎样免费建微网站建立网站平台需要多少钱
  • 今年的公需课在哪个网站做深圳关键词优化
  • dedecms微电影网站模板拓客软件排行榜
  • 怎样查看网站关键词网络销售怎么样
  • 电器网站建设目的百度网盘pc网页版入口