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

宜宾 网站建设响应式网站样式图怎么做

宜宾 网站建设,响应式网站样式图怎么做,工程建设信息网站有哪些,网站如何做微信支付宝支付在本系列Spring Cloud Config的教程系列中#xff0c;我们将讨论在运行时刷新属性配置的过程#xff0c;我们将使用Spring Boot致动器/refresh端点进行/refresh 。 此外#xff0c;我们还将研究使用RefreshScope注释刷新Value属性。 在我的Spring Cloud Config的上一教程中… 在本系列Spring Cloud Config的教程系列中我们将讨论在运行时刷新属性配置的过程我们将使用Spring Boot致动器/refresh端点进行/refresh 。 此外我们还将研究使用RefreshScope注释刷新Value属性。 在我的Spring Cloud Config的上一教程中 我们使用发现服务器和发现客户端建立了一个云配置服务并成功创建了一个示例以在具有GIT支持的存储的分布式环境中读取应用程序配置属性。在这里我们将继续进行演示运行时在Spring Cloud Config中刷新属性配置的功能。 在本文中我们将只专注于刷新配置属性。 因此我们将不会使用与发现服务器相关的配置。 我们将有一个配置服务器用于从GIT存储库和带有执行器项目的配置客户端中加载属性。 刷新属性的不同方法 刷新配置属性的一种简单方法是使用spring boot促动器提供的/refresh端点但这是一个手动过程需要针对所有实例进行触发。另一种方法是/bus/refresh与spring-cloud-bus和在这种情况下所有实例都订阅一个事件并且一旦触发该事件所有配置属性都将通过Spring Cloud Bus广播自动刷新。刷新这些属性的第三种方法是通过连接VCS。 在本文中我们将讨论弹簧启动执行器的刷新端点。 Spring Cloud Config Server实施 在上一篇文章中我们已经为该实现做好了准备。 在这里让我们简要地讨论一下。 我们在配置服务器和Spring Boot主应用程序中定义了以下application.properties它将REST端点公开为http// localhost8888以供客户端获取配置属性。 application.properties server.port8888 spring.cloud.config.server.git.urihttps://github.com/only2dhir/config-repo.git SpringCloudConfigExampleApplication.java package com.devglan.springcloudconfigexample;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer;SpringBootApplication EnableConfigServer public class SpringCloudConfigExampleApplication {public static void main(String[] args) {SpringApplication.run(SpringCloudConfigExampleApplication.class, args);} } 我们在https://github.com/only2dhir/config-repo.git上定义了外部配置属性。在这里我们为活动配置文件的本地和全局属性定义了属性。 Spring Cloud Config客户端实施 对于客户我们有以下bootstrap.properties defined.This是我们在以前的应用程序定义的相同文件在这里 bootstrap.properties spring.application.namespring-cloud-config-client spring.profiles.activelocal #spring.cloud.config.urihttp://localhost:8888使用/ refresh端点刷新配置属性 /refresh端点仅刷新使用ConfigurationProperties注释的那些属性这意味着它不刷新在应用程序初始化期间初始化的那些属性。 例如我们定义了以下配置类该类读取具有随机前缀的属性 package com.devglan.springcloudconfigclient;import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component;Component ConfigurationProperties(prefixrandom) public class PropertyConfiguration {private String property;public String getProperty() {return property;}public void setProperty(String property) {this.property property;} } 我们有以下控制器类该类使用以random为前缀的属性并且还读取以Value注释的属性 RestController public class DemoController {Value(${test.property})private String testProperty;Value(${test.local.property})private String localTestProperty;Autowiredprivate PropertyConfiguration propertyConfiguration;RequestMapping(/)public String test() {StringBuilder builder new StringBuilder();builder.append(global property - ).append(testProperty).append( || ).append(local property - ).append(localTestProperty).append( || ).append(property configuration value - ).append(propertyConfiguration.getProperty());return builder.toString();} } 对于端点http// localhost8080 / spring-cloud-config-client /将输出以下内容。 现在让我们更改定义的配置根据企业的性质spring-cloud-config-client-local.properties如下。 test.local.propertytest local property changed random.propertyrandom property changed 现在我们将调用执行器的http// localhost8080 / spring-cloud-config-client / refresh POST方法来刷新属性。 以下是具有更新属性的响应。 现在如果我们点击http// localhost8080 / spring-cloud-config-client /我们可以看到来自带有ConfigurationProperties注释的类的属性已经更新但是带有Value注释的属性尚未更新因为这是初始化的在应用程序启动期间 要更新使用Value注释的属性我们需要使用RefreshScope注释该类。 因此这里我们将使用RefreshScope注释控制器类并重新启动客户端应用程序。再次重新启动后我们将在属性文件中进行更改并将更改推送到git。 这次我们两次向属性值附加了字符串然后再次调用了刷新端点。 现在如果我们访问URL http// localhost8080 / spring-cloud-config-client /我们可以发现用Value和ConfigurationProperties注释的配置属性都已更新。 翻译自: https://www.javacodegeeks.com/2018/03/refresh-property-config-at-runtime-in-spring-cloud-config.html
http://www.pierceye.com/news/582037/

相关文章:

  • 领手工在家做的网站2019网页设计与实现论文
  • 兰州微信信息平台网站建设绍兴本地网站建设
  • 关于旅游网站策划书千锋前端培训多少钱
  • 温州网站建设结构做代练网站能备案
  • 零基础学习做网站第三方装修评估公司
  • 基础微网站开发动态网站彩票投注员做啥的
  • 西安做网站设计公司爱做网站免费版
  • 效果图网站接单重庆一般建一个网站需要多少钱
  • 网站建设征求意见稿辅料企业网站建设费用
  • 上海网站建设公司服务沅江网站制作
  • 公司网站开发费用计入什么科目虚拟主机怎么建网站
  • 天津网站建设技术网页设计与制作教程版徐洪亮课后答案
  • 旅游网站建设方案简介用asp做的网站打开页面很慢
  • 做影视网站 片源从哪里来做自媒体的上那些网站
  • 邢台网站开发百度云 做网站
  • 淘宝优惠劵网站建设wordpress主题 简洁
  • 自己做电影资源网站揭阳新闻最新消息
  • 北碚免费建站哪家做得好佛山网站建设设计
  • 怎么做网站拍卖的那种wordpress主题搜索图标
  • 三亚网站建设平台查数据的权威网站
  • html网站制作答辩ppt网站备份和备案的区别
  • 网站开发需要工具免费的ps软件
  • 常州网站建设优质商家重庆互联网怎么样
  • 做网站发广告动漫网页设计报告
  • 求职招聘网站建设投标书沈阳网站建设的公司哪家好
  • 做导航网站有发展吗南京企业网站制作哪家好
  • 千万pv网站开发成本招聘网站数建设
  • 吐鲁番大型网站建设平台找客户去哪个平台
  • 权威网站有哪些给个网站可以在线
  • 优化网站专题北京海淀网站建设公司