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

销售网站平台怎么做的深圳罗湖企业网站建设报价

销售网站平台怎么做的,深圳罗湖企业网站建设报价,网站怎么做参考文献,传奇服务器网站如何建设目录 一、问题现象 二、解决方案 三、运行结果 四、代码地址 一、问题现象 springcloud configClient获取configServer信息失败导致启动configClient注入失败 报错堆栈信息 org.springframework.beans.factory.BeanCreationException: Error creating bean with name scop…

目录

一、问题现象

二、解决方案

三、运行结果

四、代码地址


一、问题现象

springcloud configClient获取configServer信息失败导致启动configClient注入失败

报错堆栈信息

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.testController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'version' in value "${version}"

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'version' in value "${version}"

二、解决方案

经排查,原因为gitee配置文件名config-dev.properties与服务注册名不一致导致,bootstrap.yml配置了configServer地址之后,configClient从gitee中获取配置文件的时候指定了profile(dev哪个环境)以及label(newBranch4分支),但是configServer获取配置文件的时候会批量加载所有分支的配置文件信息,因此configClient和configServer配置文件关联必须由服务名以及文件名关联,因此在修改gitee中配置文件的文件名为服务名之后,configClient启动成功,并成功获取gitee中相关配置信息。

gitee中配置文件内容

git clone https://gitee.com/fzggz/springcloud.git

configServer工程的bootstrap.yml

spring:profiles:active: devapplication:name: config-servercloud:config:label: newBranchserver:git:uri: https://gitee.com/fzggz/springcloudsearchPaths: spring-cloud-config-filetimeout: 60username: ***password: ***default-label: newBranch
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/
bobo:user:name: boboage: 18

configClient的bootstrap.yml

spring:application:name: config-clientcloud:config:uri: http://127.0.0.1:8030  # 直接连接 Config-Serverprofile: devlabel: newBranch3discovery:enabled: false
#        enabled: true
#        service-id: config-server
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/

三、运行结果

configClient配置客户端代码,启动configClient后,读取configServer中读取到的配置文件信息,通过文件名,profile,label等映射关系找到version,通过@Value注入version,controller中获取

package com.ggz.configclient.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;/*** @author ggz on 2025/4/1*/
@RefreshScope
@RestController
public class TestController {@Value("${version}")private String version;@RequestMapping("/version")public String version() {return version;}
}

四、代码地址

直接导入,启动eureka和configServer以及configClient即可

https://github.com/GeGuozhi/SpringCloudDemo.git

希望有用的同时大家能帮忙能点亮一个小小的star

http://www.dtcms.com/a/464077.html

相关文章:

  • 南宁网站如何制作无锡比较大的互联网公司
  • 做网站的dw全称是啥wordpress 忘记用户名
  • 基于阿里云的电商网站建设网站主页设计素材
  • 深圳做营销网站合肥企业网站制作公司
  • 网页设计制作网站论文网页美工怎么做
  • 网站建设 豫icp备集群网站开发
  • 新西兰网站建设北京美陈设计制作公司
  • 北京电商网站开发费用上海网站建设zj kt
  • 网站内容的编辑和更新怎么做的正邦设计董事长
  • 做网站看什么书好猪猪券网站建设
  • 永兴县网站建设推广公司集团网站建设 中企动力
  • 面向对象网站开发凡科网登录手机端
  • seo网站推广与优化方案个人注册登录入口
  • 一个网站如何产生流量o2o网站大全
  • 电子商务网站策划深圳建设集团网站首页
  • 做平面设计都在那个网站找免费素材长沙市建设局官方网站
  • 能不能模仿百度一样做搜索引擎网站骨科免费咨询
  • 西安便宜网站建设成都seo优化公司排名
  • 做优惠卷网站倒闭了多少钱ps软件官方下载
  • 网站开发与制作论文开题中装建设网站
  • 建设旅游服务类网站的可行性报告什么是网站原创文章
  • 怎样做企业网站备案软件开发报价单
  • 网站开发项目经理招聘视频工厂网站建设
  • 做一手房开什么网站比较好呢iis 添加网站
  • 做照片模板下载网站好手机网站图片优化
  • 专业做高端网站wordpress缩略图插件
  • 高端网页建设上海seo搜索优化
  • 网站建设付款银行写什么用途沈阳建设企业网站
  • 地下城钓鱼网站如何做江苏省住房和建设部网站
  • 微信_网站提成方案点做企业做网站一般要多少钱