我想创建@Bean ExampleProperties.java 并且想在application.yaml 中自动获取key/value,例如:
@ConfigurationProperties("server")
public class ExampleProperties {
private String context-path; //this would be a mistake, cause you could not have "-" in parameter name,
}
Run Code Online (Sandbox Code Playgroud)
如何在application.yml中创建一个等于key的参数??
all:在我的 env 中,所有配置都存储在 localfile 中?所以我的服务配置文件存储在 classpath:configs/ 中。
因此,当 classpath:configs/ 中的文件发生更改时,需要即时刷新以提供最新属性,我需要自动刷新所有值,我该如何满足此需求?
Here is my configuration of config server:
应用程序.yml
server:
port: 8003
endpoints:
restart:
enabled: true
refresh:
enabled: true
spring:
cloud:
config:
server:
native:
searchLocations: classpath:/
etcd:
conn:
etcdPassword: 134
etcdUrls:
- http://localhost:2379
etcdUsername: root
enabled: true
etcdServicePrefix: /congiguration/project1/
enabled: true
timeout: 1
Run Code Online (Sandbox Code Playgroud)
引导程序.yml
spring:
application:
name: configurations
profiles:
active: native
Run Code Online (Sandbox Code Playgroud)
我在模块资源目录中有一个configuration.yml :
配置(-默认与否).yml
prop1: Hello
prop2: world
etcd:
conn:
etcdPassword: 134
Run Code Online (Sandbox Code Playgroud)
Here is my configuration of config client: …
这里我用的牧场主和泊坞窗 -compose初始化弹簧云配置客户端和服务器,但是当弹簧云配置的服务器还没有准备好,在客户端启动失败,并且需要在服务器已准备好重新启动。我想问一下,在服务器准备就绪时,是否有任何机制可以重新加载或重启spring-cloud-config客户端?