日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区

您的位置:首頁技術文章
文章詳情頁

淺談springcloud常用依賴和配置

瀏覽:20日期:2023-07-13 08:37:15
spring cloud常用依賴和配置整理

淺談springcloud常用依賴和配置

常用依賴

// 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'> <modelVersion>4.0.0</modelVersion> <groupId>com.roit</groupId> <artifactId>config</artifactId> <version>1.0.0</version> <!-- 微服務的包 --> <packaging>pom</packaging> <!-- spring-boot 父工程 --> <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.3.RELEASE</version><relativePath/> </parent> <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version> </properties> <dependencyManagement><dependencies> <!-- spring-cloud 依賴 https://spring.io/projects/spring-cloud --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Hoxton.SR7</version><type>pom</type><scope>import</scope> </dependency> <!-- 啟動類長運行配置 @SpringBootApplication --> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- eureka 服務端 @EnableConfigServer http://localhost:8761 --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <!-- eureka 客戶端 @EnableEurekaClient --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-netflix-eureka-client</artifactId> </dependency> <!-- consul 注冊 http://localhost:8500/ui/dc1/services --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <!-- nacos 注冊 http://localhost:8848/nacos --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <dependency><groupId>org.springframework.cloud</groupId><artifactId>nacos-client</artifactId> </dependency> <!-- feign 聲明式服務調用 替代 RestTemplate @EnableFeignClients --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <!-- hystrix 熔斷器,服務降級 @EnableCircuitBreaker --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <!-- hystrix 圖形化監控,只能監控一個服務 @EnableHystrixDashboard http://localhost:8769/hystrix --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <!-- turbine 聚合監控 @EnableTurbine http://localhost:8769/turbine.stream --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependency> <!-- spring-boot 提供的監控 --> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- 網關 --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId> </dependency> <!-- git 配置類服務端 @EnableConfigServer http://localhost/8888/master/config-dev.yml --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId> </dependency> <!-- git 配置類客戶端 --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId> </dependency> <!-- bus-rabbitmq 消息總線,做 config 自動刷新 --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId> </dependency> <!-- stream-rabbitmq 發送消息 --> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-stream-rabbit</artifactId> </dependency> <!-- sleuth + zipkin 服務鏈路追蹤。需要 zipkin 的 jar包,圖形化查看地址 http://localhost:9411--> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zipkin</artifactId> </dependency></dependencies> </dependencyManagement></project>

配置

// application.yml# 設置端口server: port: 8000# 服務名spring: application: name: eureka# eureka 配置eureka: instance: hostname: localhost client: service-url: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka # 是否需要將自己的路徑注冊到 eureka 服務端 register-with-eureka: true # 是否需要從 eureka 服務端抓取路徑 fetch-registry: true# consulspring: cloud: consul: host: localhost port: 8500 discovery:# 注冊到 consul 的服務名service-name: ${spring.application.name}# 監控界面顯示 ipprefer-ip-address: true# nacosspring: cloud: nacos: discovery:# 服務端地址server-addr: 127.0.0.1:8848# ribben 負載均衡策略provider: ribbon: NFloadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule# feign 超時配置, 集成了 ribbonribbon: # 連接超時時間 默認 1000ms ConnectTimeout: 1000 # 邏輯處理超時時間 默認 1000ms ReadTimeout: 3000#feign 集成了 hystrix,開啟 hystrixfeign: hystrix: enabled: true# feign 設置日志級別,只支持 debug, 請求響應的相關數據logging: level: com.roit.controller: debug# turbine 聚合監控turbine: combine-host-port: true # 配置監控的服務名 app-config: provider,consumer cluster-name-expression: '’default’' aggregator: cluster-config: default #instanceUrlSuffix: /actuator/hystrix.stream# gateway 網關spring: cloud: gateway: routes: - id: provider# provider 的靜態訪問路徑# uri: http://localhost:8001/# 動態uri: lb://provider# 匹配規則predicates:- Path=/goods/**# 局部過濾器filters: - AddRequestParameter=username,zs discovery:locator: # 請求路徑加上微服務名稱,http://localhost/provider/goods/ 或 http://localhost/goods/ 都行 enabled: true # 默認名稱大寫,改為允許小寫 lower-case-service-id: true# config 服務端spring: cloud: config: server:# 文件的倉庫地址git: uri: https://gitee.com/config.git # username: zs # password: 123 # 文件所在分支 label: master# config 客戶端,bootstrap.ymlspring: cloud: config: # http://localhost:8888/master/config-dev.yml # config 服務端地址 # uri: http://localhost:8888 name: config profile: dev,redis label: master # 動態配置 config 服務端地址,先將config 服務端注冊到 eureka discovery:enabled: true# config 服務端的名字,大寫service-id: config-server# config 客戶端 單服務自動刷新# 1. 加依賴 actuator# 2. 獲取數據的 controller 上加@RefreshScope# 3. curl -X POST http://localhost:8001/actuator/refreshmanagement: endpoints: web: exposure:# * 暴露所有;refresh 暴露自動刷新,/actuator/refresh。include: ’*’# bus 自動刷新,先給 config-server 發消息,再由 server 去通知所有的 config-client# bus-amqp 內部使用 rabbitmq 發消息# config-server 需暴露 bus-refresh 和 配置 rabbitmq# curl -X POST http://localhost:8888/actuator/bus-refreshinclude: ’bus-refresh’# config-client 需配置 rabbitmq 和 在獲取數據的 controller 上加 @RefreshScopespring: rabbitmq: host: localhost port: 5672 username: guest password: guest virtual-host: /# stream-rabbitspring: cloud: stream: binders:# 定義綁定器名稱mybinder: type: rabbit # 指定 mq 的環境 environment: spring: rabbitmq:host: localhostport: 5672username: guestpassword: guestvirtual-host: / bindings:# 生產者 @EnableBinding(Source.class)output:# 消費者 @EnableBinding(Sink.class), @StreamListener(Sink.INPUT)# input: binder: mybinder # 綁定的交換機名稱 destination: myexchange# sleuth + zipkinspring: zipkin: # zipkin 服務端路徑 base-url: http://lacalhost:9411/ sleuth: sampler: # 數據采集率 默認0.1 probability: 0.1

到此這篇關于淺談spring cloud常用依賴和配置的文章就介紹到這了,更多相關spring cloud依賴和配置內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区
亚洲国产日韩欧美在线| 亚久久调教视频| 国产黄色一区| 蜜臀av一区二区三区| 亚洲啊v在线| 精品九九在线| 国产一区三区在线播放| 麻豆91小视频| 免费在线观看一区| 久久精品国产99国产精品| 91九色综合| 欧美精品中文| 国产精品白浆| 国产一区国产二区国产三区| 精品三级av| 日韩亚洲一区在线| 秋霞影视一区二区三区| 国产伊人精品| aⅴ色国产欧美| 99xxxx成人网| 蜜臀久久99精品久久久画质超高清 | 神马午夜在线视频| 国产夫妻在线| 成人啊v在线| 99精品网站| 国产视频一区三区| 最新国产精品久久久| 欧美一区影院| 国产在线日韩精品| 国产精品久久久久久久免费观看 | 欧美影院视频| 久久精品午夜| 黑森林国产精品av| 国产一区日韩一区| 亚洲精品伊人| 欧美经典一区| 久久久久久久久久久9不雅视频| 婷婷综合在线| 中文字幕av一区二区三区人| 国产日韩欧美一区二区三区 | 麻豆亚洲精品| 69堂精品视频在线播放| 国内精品亚洲| 亚洲一区欧美激情| 国产精品一区高清| 天堂√8在线中文| 男人的天堂久久精品| 久久字幕精品一区| 欧美 日韩 国产一区二区在线视频| 亚洲资源网站| 大香伊人久久精品一区二区| 五月精品视频| 中文字幕日韩高清在线| 精品日韩在线| 伊人久久婷婷| 国产经典一区| 欧美日韩免费观看一区=区三区| 日本亚洲视频| 中文在线免费视频| 日韩精品亚洲专区在线观看| 国产一区国产二区国产三区| 免费日韩精品中文字幕视频在线| 久久99精品久久久久久园产越南 | 日本欧美国产| 天堂av在线一区| 国产成人免费精品| 欧美资源在线| 精品丝袜久久| 综合视频一区| 久久精品欧美一区| 国产伦理一区| 日韩视频在线一区二区三区 | 日韩精品免费视频一区二区三区| 精品视频网站| 麻豆91精品| 久久精品中文| 国产精品一区二区99| 激情欧美日韩一区| 老司机精品在线| 日本欧美在线看| 精品捆绑调教一区二区三区| 欧美亚洲二区| 另类亚洲自拍| 日本不良网站在线观看| 青青在线精品| 一区久久精品| 国产不卡精品| 久久国内精品视频| 久久国产精品亚洲77777| 国产美女高潮在线| 日韩中文字幕一区二区三区| 亚洲精品国产嫩草在线观看| 青青青国产精品| 亚洲综合三区| 999国产精品视频| 美女国产一区二区三区| 欧美专区在线| 亚洲精品1区| 98精品久久久久久久| 日韩福利视频一区| 一区二区91| 伊人久久成人| 欧洲激情综合| 久久久精品网| 伊人久久av| 成人在线视频免费| 精品中文字幕一区二区三区 | 久久九九国产| 国产成人在线中文字幕| 国产精品jk白丝蜜臀av小说| 巨乳诱惑日韩免费av| 欧美精品一区二区三区精品| 天堂av在线| 在线天堂资源www在线污| 国产成人免费精品| 国内精品美女在线观看| 精品一二三区| 久久久国产精品入口麻豆| 国产亚洲精品精品国产亚洲综合| 男女男精品网站| 丝袜国产日韩另类美女| 亚洲视频播放| 亚洲欧美日韩一区在线观看| 国产二区精品| 亚州av乱码久久精品蜜桃| 亚洲人成在线网站| 麻豆网站免费在线观看| 精品视频99| а√在线中文在线新版| 老牛影视精品| 天堂网av成人| 好吊一区二区三区| 午夜国产一区二区| 欧美/亚洲一区| 伊人久久成人| 久热精品在线| 视频一区日韩精品| 欧美亚洲自偷自偷| 国产精品一区三区在线观看| 国产精成人品2018| 国产精品久久久久久模特| 欧美亚洲色图校园春色| 国产欧美日韩精品高清二区综合区 | 日韩电影免费网址| 黄色在线观看www| 精品捆绑调教一区二区三区| 国产专区一区| 亚洲精品网址| 久久不射网站| 日韩精品第二页| 欧美影院精品| 久久av网址| 亚洲综合在线电影| 免费黄色成人| 亚洲日本国产| 美女国产精品久久久| 激情黄产视频在线免费观看| 亚洲午夜一级| 午夜电影一区| 国产精品网在线观看| 91嫩草亚洲精品| 激情偷拍久久| 亚洲日本国产| 欧美精品中文| www.九色在线| 99riav1国产精品视频| 日韩国产一二三区| 四虎国产精品免费观看| 欧美日韩精品在线一区| 亚洲高清av| 日韩美女精品| 国产精品久久观看| 奶水喷射视频一区| 久久精品国产一区二区| 99精品视频精品精品视频| 蜜桃久久久久久| 久久久久久亚洲精品美女| 99久久久国产精品美女| 一区在线免费观看| 欧美精品1区| 红桃视频亚洲| 国产精品久久久久久久久久妞妞 | 欧美1区2区3区| 欧美欧美黄在线二区| 天堂中文av在线资源库| 日韩在线成人| 99热精品久久| 国产图片一区| 久久久影院免费| 久久国产尿小便嘘嘘| 欧美日韩中文字幕一区二区三区| 日本成人手机在线| 国产99久久| 麻豆91精品91久久久的内涵| 亚洲在线一区| 热三久草你在线| 91精品一区| 亚洲在线观看| 欧洲亚洲一区二区三区| 国产精品久久乐|