首页
学习
活动
专区
圈层
工具
发布

SpringCloud入门之应用程序上下文服务(Spring Cloud Context)详解

Spring Boot对于如何使用Spring构建应用程序有一个看法:例如它具有常规配置文件的常规位置,以及用于常见管理和监视任务的端点。...这是一个Spring的功能,即子上下文从其父进程继承属性源和配置文件,因此与不使用Spring Cloud Config构建相同上下文相比,“主”应用程序上下文将包含其他属性源。...Spring的一个特性是子上下文从其父级继承属性源和配置文件,因此与构建没有Spring Cloud Config的相同上下文相比,“主”应用程序上下文包含其他属性源。...一旦设置了该标志,就会有一些更精细的设置来控制远程属性与系统属性和应用程序本地配置的位置:spring.cloud.config.overrideNone=true覆盖任何本地属性源,spring.cloud.config.overrideSystemProperties...=sample.custom.CustomPropertySourceLocator 那么“customProperty”PropertySource将显示在其类路径中包含该jar的任何应用程序中。

51000
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    理解 Spring Cloud Config:配置文件发现与命名规范

    学习目标 本文档旨在帮助你掌握 Spring Cloud Config 支持的配置文件类型,理解 Spring 官方的命名规范,探索配置客户端和服务器的发现逻辑,并学习如何通过 Eureka 服务发现集成配置管理...配置文件类型 Spring Cloud Config 支持两种主要的配置文件类型,用于满足不同场景的配置需求。...Spring Cloud Config 组件 Spring Cloud Config 由配置服务器和配置客户端两个核心组件组成。...dev,prod 来指定请求的配置文件,以及 spring.cloud.config.discovery.enabled: true 和 spring.cloud.config.discovery.service-id...配置服务器接收到请求后,扫描存储库(如 /config-repo),根据 Spring Cloud Config 的命名规范查找匹配的文件。

    26600

    为Spring Cloud Config插上管理的翅膀

    最近一致在更新Spring Cloud Config的相关内容,主要也是为这篇埋个伏笔,相信不少调研过Spring Cloud Config的用户都会吐槽它的管理能力太弱。...Spring Cloud配置中心的构建与配置 在SCCA的架构中,配置中心的核心完全采用Spring Cloud Config,所以如何构建一个配置中心完全遵循Spring Cloud Config的使用方法...:配置git仓库的地址,与配置中心的 spring.cloud.config.server.git.uri配置一致 scca.git.base-path:配置文件存储的相对路径,与配置中心的 spring.cloud.config.server.git.search-paths...创建 bootstrap.properties配置文件(也可以使用yaml可以) spring.application.name=config-client server.port=12000 spring.cloud.config.uri...创建 bootstrap.properties配置文件(也可以使用yaml可以) spring.application.name=config-client server.port=12000 spring.cloud.config.discovery.enabled

    1.2K40

    Spring Cloud(八)高可用的分布式配置中心 Spring Cloud Config

    在Spring Cloud中,有分布式配置中心组件spring cloud config,它支持配置服务放在配置服务的内存中(即本地),也支持放在远程Git仓库中。...Spring Cloud Config 简介 SpringCloudConfig就是我们通常意义上的配置中心,把应用原本放在本地文件的配置抽取出来放在中心服务器,从而能够提供更好的管理、发布能力。...:配置仓库路径 spring.cloud.config.label:配置仓库的分支 spring.cloud.config.server.git.username:访问git仓库的用户名 spring.cloud.config.server.git.password...远程Git仓库 spring-cloud-config 文件夹下有 application-dev.properties,application-test.properties 三个文件,内容依次是:content...指明远程仓库的分支 spring.cloud.config.profile dev开发环境配置文件 test测试环境 pro正式环境 spring.cloud.config.uri= http://localhost

    99760

    Spring Cloud Config对特殊字符加密的处理

    之前写过一篇关于配置中心对配置内容加密解密的介绍:《Spring Cloud构建微服务架构:分布式配置中心(加密解密)》。...在这篇文章中,存在一个问题:当被加密内容包含一些诸如 =、 +这些特殊字符的时候,使用上篇文章中提到的类似这样的命令 curl localhost:7001/encrypt-d去加密和解密的时候,会发现特殊字符丢失的情况...由于之前在这里也小坑了一下,所以抽空写出来分享一下,给遇到同样问题的朋友,希望对您有帮助。...问题原因与处理方法 其实关于这个问题的原因在官方文档中是有具体说明的,只能怪自己太过粗心了,具体如下: If you are testing like this with curl, then use...所以,在使用 curl的时候,正确的姿势应该是: $ curl localhost:7001/encrypt -H 'Content-Type:text/plain' --data-urlencode

    99140

    Config Server——配置内容的加密与解密 详解

    安装JCE Config Server的加解密功能依赖Java Cryptography Extension(JCE)。...下载JCE,解压后,按照README.txt的说明即可安装,其实就是将JDK/jre/lib/security目录中的两个jar文件替换为JCE中的jar文件。...其他Java版本的JCE的下载地址及安装在Spring Cloud 文档中有提及,详见:http://cloud.spring.io/spring-cloud-static/Camden.SR2/#_cloud_native_applications...一些场景下,我们可能想要让Config Server直接返回密文本身,而并非解密后的内容,这时可设置spring.cloud.config.server.encrypt.enabled=false 。...这时可由Config Client自行解密。 非对称加密 上文中,我们讨论的加密方式是对称加密,Spring Cloud同样支持非对称加密。

    1.2K60

    Spring Cloud Bus集成Spring Cloud Config Server实现全局配置的自动刷新(一)

    Spring Cloud Bus 是 Spring Cloud 体系中的一个模块,它通过消息代理实现微服务之间的通信,主要用于广播配置文件或其他系统管理指令,可以帮助我们实现全局配置的自动刷新。...Spring Cloud Config Server 是 Spring Cloud 配置中心的实现,它可以统一管理配置文件,通过 HTTP 或者 Git 等方式提供配置文件的访问服务。...一、Spring Cloud Bus 概述Spring Cloud Bus 是 Spring Cloud 的一个组件,它的主要作用是让分布式系统的节点之间可以方便的共享消息,以及使用消息代理实现全局的广播...二、Spring Cloud Bus 的使用添加依赖首先需要在项目的 pom.xml 文件中添加 Spring Cloud Bus 的依赖: org.springframework.cloud...配置 Bus接下来需要在项目的 application.properties 文件中添加 Bus 的配置:spring.cloud.bus.enabled=true这里配置了开启 Spring Cloud

    49710

    Spring Cloud Bus集成Spring Cloud Config Server实现全局配置的自动刷新(二)

    三、Spring Cloud Config Server 的集成添加依赖首先需要在项目的 pom.xml 文件中添加 Spring Cloud Config Server 和 Spring Cloud...配置 Config Server在项目的 application.properties 文件中添加 Config Server 的配置::spring.application.name=config-serverspring.cloud.config.server.git.uri...添加 Spring Cloud Bus 到 Config Server为了实现全局配置的自动刷新,还需要在 Config Server 中添加 Spring Cloud Bus 的依赖。...配置 Spring Cloud Bus 到 Config Server接下来需要在 Config Server 的 application.properties 文件中添加 Spring Cloud Bus...监听 Config Server 的事件最后需要在微服务的配置文件中添加监听 Config Server 的事件:spring.cloud.config.uri=http://localhost:8888spring.cloud.config.name

    38430

    Spring Cloud构建微服务架构:分布式配置中心(加密解密)

    很显然,如果我们直接将敏感信息以明文的方式存储于微服务应用的配置文件中是非常危险的。针对这个问题,Spring Cloud Config提供了对属性进行加密解密的功能,以保护配置文件中的信息安全。...在Spring Cloud Config中通过在属性值前使用 {cipher}前缀来标注该内容是一个加密值,当微服务客户端来加载配置时,配置中心会自动的为带有 {cipher}前缀的值进行解密。...使用前提 在使用Spring Cloud Config的加密解密功能时,有一个必要的前提需要我们注意。...我们可以从Oracle的官方网站中下载到它,它是一个压缩包,解压后可以看到下面三个文件: README.txt local_policy.jar US_export_policy.jar 我们需要将 local_policy.jar...非对称加密 Spring Cloud Config的配置中心不仅可以使用对称性加密,也可以使用非对称性加密(比如:RSA密钥对)。虽然非对称性加密的密钥生成与配置相对复杂一些,但是它具有更高的安全性。

    1.1K70

    spring cloud 入门系列七:基于Git存储的分布式配置中心–Spring Cloud Config

    我们前面接触到的spring cloud组件都是基于Netflix的组件进行实现的,这次我们来看下spring cloud 团队自己创建的一个全新项目:Spring Cloud Config....=https://gitee.com/sam-uncle/spring-cloud-learning/ #配置仓库路径下的相对搜索位置,可以配置多个 spring.cloud.config.server.git.search-paths...=spring-cloud-config-file #这里配置你的Git仓库的用户名 spring.cloud.config.server.git.username=用户名 #这里配置你的Git仓库的密码...spring.cloud.config.server.git.password=密码 启动并验证     访问配置信息的URL与配置文件的映射关系如下: /{application}/{...,指定config-server位置 server.port=7002 #{application} spring.application.name=sam #{profile} spring.cloud.config.profile

    57320

    Spring Cloud(十)高可用的分布式配置中心 Spring Cloud Config 中使用 Refresh

    Refresh 实现主动获取 Config Server 配置服务中心的最新配置 准备工作 把上一篇,示例代码下载,才可以进行一下的操作,下载地址在文章末尾 spring-cloud-eureka-service...spring-cloud-config-server spring-cloud-eureka-provider-1 spring-cloud-eureka-provider-2 spring-cloud-eureka-provider...-3 spring-cloud-feign-consumer Config Client 修改第九篇文章项目 spring-cloud-eureka-provider-1 spring-cloud-eureka-provider...spring-cloud-config-server spring-cloud-eureka-provider-1 spring-cloud-eureka-provider-2 spring-cloud-eureka-provider...留了一个悬念,Config Client 实现配置的实时更新,我们可以使用 /refresh 接口触发,如果所有配置的更改,都需要手动触发,那岂不是维护成本很高,而使用 Spring Cloud Bus

    743100

    Spring Cloud(九)高可用的分布式配置中心 Spring Cloud Config 集成 Eureka 服务

    -3 Eureka Consumer 导入第四篇文章中的项目:作为服务的消费者 spring-cloud-feign-consumer 服务端配置 Config Server 复制上一篇的项目 spring-cloud-config-server...:配置仓库路径 spring.cloud.config.label:配置仓库的分支 spring.cloud.config.server.git.username:访问git仓库的用户名 spring.cloud.config.server.git.password...远程Git仓库 spring-cloud-config 文件夹下有 application-dev.properties,application-test.properties 三个文件,内容依次是:content...spring.cloud.config.label 指明远程仓库的分支 spring.cloud.config.profile dev开发环境配置文件 test测试环境 pro正式环境 #spring.cloud.config.uri...= http://localhost:8888/ 指明配置服务中心的网址(注释掉) spring.cloud.config.discovery.enabled=true 是从配置中心读取文件。

    95550
    领券