添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
【springcloud问题】Could not locate PropertySource and the fail fast property is set, failing
最新推荐文章于 2022-07-31 21:08:46 发布
最新推荐文章于 2022-07-31 21:08:46 发布 阅读量 2.1w
问题描述:使用springcloud的本地配置中心时出现:Could not locate PropertySource and the fail fast property is set, failing
  • 解决办法
    使用的配置中心的依赖不加版本就行了,即使用导入的springcloud版本中的 spring-cloud-config-server 的默认依赖就行了。
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

之前的依赖我是加版本的,可能是因为版本不兼容问题,所以springcloud一定要注意版本对应的关系

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
            <!--之前的依赖添加了版本号-->
            <version>2.2.1.RELEASE</version>
        </dependency>
  1. 使用的springboot版本2.3.4.RELEASE
  2. 使用的springcloud版本Hoxton.SR2
    首先springboot和springcloud的版本有对应关系,不能乱用版本。
    详细版本对应关系
  • 问题详情
    使用springcloud的配置中心,让其使用的是本地的配置中心。目的是让order-serverbootstrap.yml读取配置中心config-serverorder-dev.yml配置文件的信息,将order-dev.yml的信息读取到order-serverOrderController中使用。
    项目结构如图
    项目结构
    配置中心的设置
    在这里插入图片描述
    order服务的设置
    在这里插入图片描述

order-dev.yml的简单内容
在这里插入图片描述

OrderController中测试
在这里插入图片描述

Could not locate PropertySource and the fail fast property is set, failing org.springframework.web.client.HttpClientErrorException$Unauthorized: 401 null java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocato java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:132) at or. java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing: {"timestamp":"2019-08-24T14:16:37.578+0000","status":500,"error":"Internal Server Error","m... 启动springcloud项目时,出现java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing 原因是:服务没有读取到git上的配置文件导致。 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> 报错如下:Could not locate @使用jupyter notebook运行object_detection_tutorial.ipynb,运用的自己训练的pb出现错误。 detection_graph = tf.Graph() with detection_graph.as_default(): od_graph_def = tf.GraphDef() with tf.gfile.GFile(PATH_TO_FROZEN... 2018-09-20 11:20:30.514 WARN [provider-demo,,,] 17603 --- [on(6)-127.0.0.1] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for &quot;http://localhost:... Could not locate PropertySource: I/O error on GET request for “http://localhost:8888/hzero-swagger/default” 这是因为Spring中默认配置中心的port是8888如果未配置Spring cloud的地址就会默认连接此端口地址。可以加上如下配置,修复配置中心地址到正确的地址。 spring: profiles: active: ${SPRING_PROFILES_ACTIVE:defau.