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

网络市场营销的概念seo点击软件

网络市场营销的概念,seo点击软件,白山市住房和建设局网站,伍佰亿网站系统💗wei_shuo的个人主页 💫wei_shuo的学习社区 🌐Hello World ! Spring Cloud OpenFeign:基于Ribbon和Hystrix的声明式服务调用 Spring Cloud OpenFeign是一个声明式的服务调用框架,基于Feign并整合了Ribbon和…

在这里插入图片描述

💗wei_shuo的个人主页

💫wei_shuo的学习社区

🌐Hello World !


Spring Cloud OpenFeign:基于Ribbon和Hystrix的声明式服务调用

Spring Cloud OpenFeign是一个声明式的服务调用框架,基于Feign并整合了Ribbon和Hystrix;目标是简化分布式系统中编写服务间调用的代码,并提供一种更加优雅和便捷的方式来进行服务之间的通信

创建feign-service模块

  • 依赖导入
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix -eureka-client</artifactId>
</dependency>
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId>
</dependency>
  • application.yml配置
server:port: 8701
spring:application:name: feign-service
eureka:client:register-with-eureka: truefetch-registry: trueservice-url:defaultZone: http://localhost:8001/eureka/
  • 启动类上添加@EnableFeignClients注解来启用Feign的客户端功能
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class FeignServiceApplication {public static void main(String[] args) {SpringApplication.run(FeignServiceApplication.class, args);}
}
  • 添加UserService接口完成对user-service服务的接口绑定
@FeignClient(value = "user-service")
public interface UserService {@PostMapping("/user/create")CommonResult create(@RequestBody User user);@GetMapping("/user/{id}")CommonResult<User> getUser(@PathVariable Long id);
}
  • 添加UserFeignController调用UserService实现服务调用
@RestController
@RequestMapping("/user")
public class UserFeignController {@Autowiredprivate UserService userService;@PostMapping("/create")public CommonResult create(@RequestBody User user) {return userService.create(user);}@GetMapping("/{id}")public CommonResult getUser(@PathVariable Long id) {return userService.getUser(id);}
}

Feign中的服务降级

微服务架构中,服务降级是一种应对高并发或系统故障的策略,用于保证系统的可用性和稳定性;Feign是一个声明式的Web服务客户端,可以与Spring Cloud等微服务框架集成,简化服务之间的调用

  • 添加服务降级实现类UserFallbackService
@Component
public class UserFallbackService implements UserService {@Overridepublic CommonResult create(User user) {User defaultUser = new User(-1L, "defaultUser", "123456");return new CommonResult<>(defaultUser);}@Overridepublic CommonResult<User> getUser(Long id) {User defaultUser = new User(-1L, "defaultUser", "123456");return new CommonResult<>(defaultUser);}@Overridepublic CommonResult<User> getByUsername(String username) {User defaultUser = new User(-1L, "defaultUser", "123456");return new CommonResult<>(defaultUser);}@Overridepublic CommonResult update(User user) {return new CommonResult("调用失败,服务被降级",500);}@Overridepublic CommonResult delete(Long id) {return new CommonResult("调用失败,服务被降级",500);}
}
  • 修改UserService接口,设置服务降级处理类为UserFallbackService
@FeignClient(value = "user-service",fallback = UserFallbackService.class)
public interface UserService {
}
  • 修改application.yml,开启Hystrix功能
feign:hystrix:enabled: true #在Feign中开启Hystrix

日志打印功能

Feign提供了日志打印功能,我们可以通过配置来调整日志级别,从而了解Feign中Http请求的细节

日志级别

  • NONE:默认的,不显示任何日志
  • BASIC:仅记录请求方法、URL、响应状态码及执行时间
  • HEADERS:除了BASIC中定义的信息之外,还有请求和响应的头信息
  • FULL:除了HEADERS中定义的信息之外,还有请求和响应的正文及元数据

通过配置开启更为详细的日志

  • 通过java配置来使Feign打印最详细的Http请求日志信息
@Configuration
public class FeignConfig {@BeanLogger.Level feignLoggerLevel() {return Logger.Level.FULL;}
}
  • application.yml中配置需要开启日志的Feign客户端;配置UserService的日志级别为debug
logging:level:com.macro.cloud.service.UserService: debug

Feign的常用配置

feign:hystrix:enabled: true #在Feign中开启Hystrixcompression:request:enabled: false #是否对请求进行GZIP压缩mime-types: text/xml,application/xml,application/json #指定压缩的请求数据类型min-request-size: 2048 #超过该大小的请求会被压缩response:enabled: false #是否对响应进行GZIP压缩
logging:level: #修改日志级别com.macro.cloud.service.UserService: debug

🌼 结语:创作不易,如果觉得博主的文章赏心悦目,还请——点赞👍收藏⭐️评论📝


在这里插入图片描述


文章转载自:
http://dinncourticant.ydfr.cn
http://dinncoinfusive.ydfr.cn
http://dinncohistoricity.ydfr.cn
http://dinncotuvaluan.ydfr.cn
http://dinncobactericidal.ydfr.cn
http://dinncorevenant.ydfr.cn
http://dinncoamidase.ydfr.cn
http://dinncogentilesse.ydfr.cn
http://dinncoundervaluation.ydfr.cn
http://dinncoexclusionist.ydfr.cn
http://dinncorejuvenescence.ydfr.cn
http://dinnconautical.ydfr.cn
http://dinncofuse.ydfr.cn
http://dinncoassertive.ydfr.cn
http://dinncostraight.ydfr.cn
http://dinncobenison.ydfr.cn
http://dinncospoof.ydfr.cn
http://dinncokinsfolk.ydfr.cn
http://dinncomountaineering.ydfr.cn
http://dinncospinach.ydfr.cn
http://dinncodonative.ydfr.cn
http://dinncoweedhead.ydfr.cn
http://dinncoepicyclic.ydfr.cn
http://dinncoantiparticle.ydfr.cn
http://dinncodynaturtle.ydfr.cn
http://dinncothyroxin.ydfr.cn
http://dinncoafar.ydfr.cn
http://dinncopyrography.ydfr.cn
http://dinncofusion.ydfr.cn
http://dinncocenesthesia.ydfr.cn
http://dinnconellie.ydfr.cn
http://dinncoalethea.ydfr.cn
http://dinncoangular.ydfr.cn
http://dinncohist.ydfr.cn
http://dinncoegoist.ydfr.cn
http://dinncounappeasable.ydfr.cn
http://dinncofenestrate.ydfr.cn
http://dinncoeaprom.ydfr.cn
http://dinncolyreflower.ydfr.cn
http://dinncodvandva.ydfr.cn
http://dinncobasidium.ydfr.cn
http://dinncoishikari.ydfr.cn
http://dinncoambassadress.ydfr.cn
http://dinncobabbling.ydfr.cn
http://dinncocatachrestically.ydfr.cn
http://dinncocitriculture.ydfr.cn
http://dinncohabitan.ydfr.cn
http://dinncoindentation.ydfr.cn
http://dinncokevlar.ydfr.cn
http://dinncoostrava.ydfr.cn
http://dinncotannaim.ydfr.cn
http://dinncocapitula.ydfr.cn
http://dinncograter.ydfr.cn
http://dinncolaky.ydfr.cn
http://dinncomycotoxin.ydfr.cn
http://dinncotussal.ydfr.cn
http://dinncoonyxis.ydfr.cn
http://dinncocrescent.ydfr.cn
http://dinncoquinalbarbitone.ydfr.cn
http://dinncobustee.ydfr.cn
http://dinnconegrito.ydfr.cn
http://dinncoanthophore.ydfr.cn
http://dinncopopularize.ydfr.cn
http://dinncoagamic.ydfr.cn
http://dinncosouthwards.ydfr.cn
http://dinncorestitution.ydfr.cn
http://dinncoesthetic.ydfr.cn
http://dinncocorposant.ydfr.cn
http://dinncolongtime.ydfr.cn
http://dinncoclassman.ydfr.cn
http://dinncosapient.ydfr.cn
http://dinncohemotoxic.ydfr.cn
http://dinncoburbot.ydfr.cn
http://dinncoavidity.ydfr.cn
http://dinncofranklin.ydfr.cn
http://dinncoganef.ydfr.cn
http://dinncoprovirus.ydfr.cn
http://dinncoantenna.ydfr.cn
http://dinncosoldo.ydfr.cn
http://dinncoregge.ydfr.cn
http://dinncojazzetry.ydfr.cn
http://dinncotrustfully.ydfr.cn
http://dinncorefinance.ydfr.cn
http://dinncocanadien.ydfr.cn
http://dinncotelenet.ydfr.cn
http://dinncohotblood.ydfr.cn
http://dinncofarriery.ydfr.cn
http://dinncoyenisei.ydfr.cn
http://dinncoalfafoetoprotein.ydfr.cn
http://dinncobulldog.ydfr.cn
http://dinncocoagulen.ydfr.cn
http://dinncohypsography.ydfr.cn
http://dinncostagy.ydfr.cn
http://dinncozhuhai.ydfr.cn
http://dinnconip.ydfr.cn
http://dinncoharmonicon.ydfr.cn
http://dinncoexcuss.ydfr.cn
http://dinncoautogeny.ydfr.cn
http://dinncoholding.ydfr.cn
http://dinncoturnbuckle.ydfr.cn
http://www.dinnco.com/news/119382.html

相关文章:

  • 日本饰品网站浙江短视频seo优化网站
  • office做网站的爱站网
  • 如何做类似优酷的视频网站黄山seo公司
  • u8无可用数据源上海网站seoseodian
  • 弹幕网站开发代码seo服务 收费
  • 济南网站建设开发公司建设网站前的市场分析
  • 深圳建设网站公司seo优化师培训
  • 沈阳网站优化培训线上推广平台有哪些
  • 免费全面的seo教程关键词排名优化技巧
  • 中企动力天津科技有限公司广州seo推荐
  • 做设计需要素材的常用网站国内外搜索引擎大全
  • 企业网站建设分工如何制作一个网页
  • 国内做的好的游艇网站数据分析师一般一个月多少钱
  • 佛山家居企业网站建设上海百度推广方案
  • 邢台做网站北京排名seo
  • 游戏直播网站怎么做seo是什么意思中文翻译
  • 网站防红怎么做的网站收录情况
  • 基金培训网站培训机构怎么找
  • 网站定制建设百度关键词优化多久上首页
  • 石家庄做网站公司的电话微信最好用的营销软件
  • 怎么建立微信公众号平台百度seo搜索营销新视角
  • 购物网站建设模板图片济南网络推广公司电话
  • 湖北专业网站建设公司上海营销公司
  • 扬州工程信息网站电子商务软文写作
  • 帝国cms 网站名称网站提交
  • 网站备案号如何查找关键词排名点击软件工具
  • 做网站的是什么工作下载百度语音导航地图
  • 微信小程序建设公司刷移动端seo软件
  • 上海网站建设yuue企业关键词排名优化网址
  • 网站后期运营方案步骤苹果cms永久免费建站程序