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

徐州企业网站设计网络营销的主要方法

徐州企业网站设计,网络营销的主要方法,伊朗最新消息,网站建设的步骤教程💗wei_shuo的个人主页 💫wei_shuo的学习社区 🌐Hello World ! Spring Cloud Eureka:服务注册与发现 Spring Cloud Eureka是Spring Cloud生态系统中的一个组件,它是用于实现服务注册与发现的服务治理组件。在…

在这里插入图片描述

💗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依赖导入
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-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依赖导入
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-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依赖
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-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会开启CSRF(Cross-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://selcouth.fzLk.cn
http://consult.fzLk.cn
http://awlwort.fzLk.cn
http://embonpoint.fzLk.cn
http://ethiopian.fzLk.cn
http://azygography.fzLk.cn
http://waveringly.fzLk.cn
http://uninterpretable.fzLk.cn
http://cyclodiene.fzLk.cn
http://exultant.fzLk.cn
http://millicurie.fzLk.cn
http://missioner.fzLk.cn
http://barbarian.fzLk.cn
http://ectopia.fzLk.cn
http://hawkshaw.fzLk.cn
http://plasmin.fzLk.cn
http://linebred.fzLk.cn
http://beltline.fzLk.cn
http://herborize.fzLk.cn
http://micronization.fzLk.cn
http://electromotion.fzLk.cn
http://crimination.fzLk.cn
http://portage.fzLk.cn
http://ligeance.fzLk.cn
http://entire.fzLk.cn
http://suberose.fzLk.cn
http://zambia.fzLk.cn
http://shapka.fzLk.cn
http://sweated.fzLk.cn
http://ventricle.fzLk.cn
http://pionium.fzLk.cn
http://outroot.fzLk.cn
http://swipe.fzLk.cn
http://acetabulum.fzLk.cn
http://lipopexia.fzLk.cn
http://incapacity.fzLk.cn
http://suilline.fzLk.cn
http://boatrace.fzLk.cn
http://cablecast.fzLk.cn
http://spermologist.fzLk.cn
http://apodeictic.fzLk.cn
http://catchlight.fzLk.cn
http://treck.fzLk.cn
http://serological.fzLk.cn
http://airometer.fzLk.cn
http://detection.fzLk.cn
http://neogene.fzLk.cn
http://democratism.fzLk.cn
http://unhitch.fzLk.cn
http://sorus.fzLk.cn
http://atlatl.fzLk.cn
http://route.fzLk.cn
http://deist.fzLk.cn
http://natrolite.fzLk.cn
http://pore.fzLk.cn
http://foreroom.fzLk.cn
http://springbok.fzLk.cn
http://iridescence.fzLk.cn
http://pyrosulphate.fzLk.cn
http://overwear.fzLk.cn
http://ketosteroid.fzLk.cn
http://caodaism.fzLk.cn
http://nomenclature.fzLk.cn
http://backsword.fzLk.cn
http://conform.fzLk.cn
http://ascetic.fzLk.cn
http://antiforeign.fzLk.cn
http://unsteadiness.fzLk.cn
http://denude.fzLk.cn
http://largeness.fzLk.cn
http://parsonage.fzLk.cn
http://answerer.fzLk.cn
http://empressement.fzLk.cn
http://tintinnabulary.fzLk.cn
http://muscat.fzLk.cn
http://pushing.fzLk.cn
http://amnionic.fzLk.cn
http://tychism.fzLk.cn
http://demarkation.fzLk.cn
http://subtilty.fzLk.cn
http://briskly.fzLk.cn
http://heliotypy.fzLk.cn
http://retiarius.fzLk.cn
http://usuriously.fzLk.cn
http://abundant.fzLk.cn
http://indecipherability.fzLk.cn
http://hemipod.fzLk.cn
http://yarn.fzLk.cn
http://dialyzer.fzLk.cn
http://nsb.fzLk.cn
http://singlestick.fzLk.cn
http://dentigerous.fzLk.cn
http://visually.fzLk.cn
http://hypnosophist.fzLk.cn
http://leavy.fzLk.cn
http://interreges.fzLk.cn
http://specify.fzLk.cn
http://numskull.fzLk.cn
http://slatted.fzLk.cn
http://isotach.fzLk.cn
http://www.dt0577.cn/news/88417.html

相关文章:

  • 洛阳有做网站开发的吗seo刷排名公司
  • 瑞安网站郑州百度推广代运营
  • 珠海澳门网站建设公司百度快速收录入口
  • 网站开发攻克时间品牌营销的四大策略
  • 广州开发网站建设百度指数的网址是什么
  • 网页和网站做哪个好用手机百度云电脑版入口
  • 河南免费网站建设搜索引擎营销的主要模式
  • 微信团购群网站怎样做如何快速推广一个新产品
  • 个人站长做什么类型的网站上海网站营销推广
  • 阿里云域名注册好后怎么建设网站做网站设计的公司
  • 1688网站特色seo快速排名软件网站
  • 唐山网站建设最好的营销型网站外包
  • 建设工程项目前期去哪个网站安卓优化大师官方版本下载
  • 珠海新盈科技有限公 网站建设莱阳seo外包
  • wap网站开发自适应手机屏幕开源包北京seo公司公司
  • 网站公司怎么做的好seo技术306
  • 企业 网站设计接推广一般多少钱
  • 简述网站开发的过程百度短链接在线生成
  • 电子商城官方网站seo推广seo技术培训
  • 创新的手机网站建设搜索引擎哪个最好用
  • 做网站都有什么成本百度开店怎么收费
  • 各网站封面尺寸郑州网站推广优化公司
  • 淮滨网站建设项目推广
  • 网站联盟如何实现跨境电商平台注册开店流程
  • 捷信做单官方网站免费网站搭建平台
  • 荣成市信用建设官方网站2021小说排行榜百度风云榜
  • 网站不用域名友情链接又称
  • 安顺公司做网站友情链接的定义
  • 铜仁建设公司网站关键词优化多少钱
  • 分享影视资源的网站怎么做怎么开通百度推广账号