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

做网站什么硬盘好拼多多网页qq登录

做网站什么硬盘好,拼多多网页qq登录,做视频分享网站的参考书,wordpress二级分类#x1f497;wei_shuo的个人主页 #x1f4ab;wei_shuo的学习社区 #x1f310;Hello World #xff01; Spring Cloud Eureka#xff1a;服务注册与发现 Spring Cloud Eureka是Spring Cloud生态系统中的一个组件#xff0c;它是用于实现服务注册与发现的服务治理组件。在… wei_shuo的个人主页 wei_shuo的学习社区 Hello World Spring Cloud Eureka服务注册与发现 Spring Cloud Eureka是Spring Cloud生态系统中的一个组件它是用于实现服务注册与发现的服务治理组件。在微服务架构中服务之间存在复杂的依赖关系而Spring Cloud Eureka可以帮助解决服务之间相互查找和通信的问题 Eureka简介 Eureka是Netflix开源的服务发现组件用于在分布式系统中实现服务注册与发现。它是Netflix公司在构建微服务架构时开发的核心组件之一后来成为了Spring Cloud生态系统中的一部分 Eureka注册中心搭建 Eureka服务端搭建 eureka-server依赖导入 dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-eureka-server/artifactId /dependency启动类添加注解EnableEurekaServer EnableEurekaServer SpringBootApplication public class EurekaServerApplication {public static void main(String[] args) {SpringApplication.run(EurekaServerApplication.class, args);} }配置文件application.yml配置 server:port: 8001 #指定运行端口 spring:application:name: eureka-server #指定服务名称 eureka:instance:hostname: localhost #指定主机地址client:fetch-registry: false #指定是否要从注册中心获取服务注册中心不需要开启register-with-eureka: false #指定是否要注册到注册中心注册中心不需要开启server:enable-self-preservation: false #关闭保护模式Eureka客户端搭建 eureka-client依赖导入 dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-eureka-client/artifactId /dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId /dependency启动类添加注解EnableDiscoveryClient EnableDiscoveryClient SpringBootApplication public class EurekaClientApplication {public static void main(String[] args) {SpringApplication.run(EurekaClientApplication.class, args);} }配置文件application.yml配置 server:port: 8101 #运行端口号 spring:application:name: eureka-client #服务名称 eureka:client:register-with-eureka: true #注册到Eureka的注册中心fetch-registry: true #获取注册实例列表service-url:defaultZone: http://localhost:8001/eureka/ #配置注册中心地址Eureka集群搭建 eureka-sever添加配置文件application-replica1.yml配置第一个注册中心 server:port: 8002 spring:application:name: eureka-server eureka:instance:hostname: replica1client:serviceUrl:defaultZone: http://replica2:8003/eureka/ #注册到另一个Eureka注册中心fetch-registry: trueregister-with-eureka: true给eureka-sever添加配置文件application-replica2.yml配置第二个注册中心 server:port: 8003 spring:application:name: eureka-server eureka:instance:hostname: replica2client:serviceUrl:defaultZone: http://replica1:8002/eureka/ #注册到另一个Eureka注册中心fetch-registry: trueregister-with-eureka: true修改Eureka-client连接到集群 server:port: 8102 spring:application:name: eureka-client eureka:client:register-with-eureka: truefetch-registry: trueservice-url:defaultZone: http://replica1:8002/eureka/,http://replica2:8003/eureka/ #同时注册到两个注册中心Eureka添加认证 添加SpringSecurity依赖 dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-eureka-server/artifactId /dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-security/artifactId /dependency添加application.yml配置文件配置用户名、密码 server:port: 8004 spring:application:name: eureka-security-serversecurity: #配置SpringSecurity登录用户名和密码user:name: macropassword: 123456 eureka:instance:hostname: localhostclient:fetch-registry: falseregister-with-eureka: false添加 Java 配置WebSecurityConfig 默认情况下Spring Security会开启CSRFCross-Site Request Forgery保护这是一种用于防止跨站点请求伪造攻击的安全机制。当你添加了Spring Security依赖到应用程序中时每个POST、PUT、DELETE等修改类请求都需要在请求头中包含CSRF token才能被服务器接受 默认情况下添加SpringSecurity依赖的应用每个请求都需要添加CSRF token才能访问Eureka客户端注册时并不会添加所以需要配置/eureka/**路径不需要CSRF token EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {Overrideprotected void configure(HttpSecurity http) throws Exception {http.csrf().ignoringAntMatchers(/eureka/**);super.configure(http);} }结语创作不易如果觉得博主的文章赏心悦目还请——点赞收藏⭐️评论
http://www.zqtcl.cn/news/708325/

相关文章:

  • 高校校园网站建设与运行网站规划教学设计
  • 包头手机网站制作seo推广手段
  • 汕头网站推广seo品牌网站建设 app建设
  • 网站后台word编辑器如何申请一个网站 做视频
  • 源代码做网站网站编辑可以做运营吗
  • 小游戏网站模板无锡网站建设818gx
  • 娄底做网站陕西网站维护
  • 电子商务网站建设首要问题是佛山网站设计步骤
  • iphone网站哈尔滨做平台网站平台公司吗
  • 公司网站制作高端有什么网站可以做外贸出口信息
  • 旅游网站建设ppt自己动手制作网站
  • 做注册任务的网站有哪些seo搜索排名优化
  • 用php做网站和go做网站网站建设 完成
  • 做平面设计在那个网站上找图好网站广告出价平台
  • 网站点击率查询wordpress忘记后台账号
  • 网站怎么做全屏的网站建设报价比较表
  • 商城网站项目案例简单的明星个人网站建设论文
  • 腾讯云建网站如何利用谷歌云做自己的网站
  • 合肥网站搭建著名的网站建设公司
  • win7的iis怎么制作网站网页制作基础代码
  • 黄页网站大全免费网在线进一步优化供给推动消费平稳增长
  • dw中怎样做网站链接网页版qq登录入口账号密码
  • 外贸网站建设soho中国建设银行网站易方达消费
  • 淘宝客网站推广怎么做图文识别微信小程序是什么
  • 郑州网站建设、北京做网页公司
  • 代码错误网站wordpress主题屏蔽更新
  • 建五金方面的网站广告联盟app手机版
  • 宜宾建设网站公众号怎么制作流程
  • 上海崇明网站建设崇信县门户网站首页
  • 北京手机版建站系统开发学网页设计需要什么学历