Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot spring boot在不使用配置服务器的情况下刷新属性文件_Spring Boot_Spring Boot Actuator - Fatal编程技术网

Spring boot spring boot在不使用配置服务器的情况下刷新属性文件

Spring boot spring boot在不使用配置服务器的情况下刷新属性文件,spring-boot,spring-boot-actuator,Spring Boot,Spring Boot Actuator,我想在spring boot中刷新属性文件 版本-2.1.4.1发布 在spring配置服务器的情况下,必须将我的所有应用程序连接到配置服务器,这是我不想要的,因为我们的应用程序在prod中,我们不想要更大的更改。 在同一个应用程序中,我是否可以使用config server刷新prop文件?如果不使用config server,则使用一些spring代码 我能做吗。 不是application.properties,而是application-optional.properties,项目之外的

我想在spring boot中刷新属性文件

版本-2.1.4.1发布

在spring配置服务器的情况下,必须将我的所有应用程序连接到配置服务器,这是我不想要的,因为我们的应用程序在prod中,我们不想要更大的更改。 在同一个应用程序中,我是否可以使用config server刷新prop文件?如果不使用config server,则使用一些spring代码 我能做吗。
不是application.properties,而是application-optional.properties,项目之外的属性只想刷新它。

Spring Cloud提供了
RefreshEndpoint
。添加SpringCloudStarter配置将使您获得需要刷新的bean和API

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>

org.springframework.cloud
SpringCloudStarter配置

此外,您需要通过
management.endpoints.web.exposure.include=“health,info,refresh”
公开API,也可以使用
“*”
将每个启用的执行器端点公开到web。

感谢ans。但是spring cloud starter配置需要git repo,但我不需要它。我只有一个可选属性文件,所以我只想刷新它。没什么。不,它不需要git repo,
其他源是任何与JDBC兼容的数据库,Subversion,Hashicorp Vault、Credhub和**本地文件系统。**
您需要starter提供的所有功能才能正确刷新属性,执行器API只是其中的一部分。抱歉,但是我不想使用spring配置服务器,因为我必须将我的应用程序连接到spring配置服务器。我的项目外部有一个可选的属性文件。我只想调用一些get方法重新加载该值。