oapi-sdk-java icon indicating copy to clipboard operation
oapi-sdk-java copied to clipboard

怎么提取appId等变量到application.properties?

Open yumoyi opened this issue 4 years ago • 3 comments

我提取appId等变量到application.properties中,使用@Value,可以Config.createInternalAppSettings()需要静态变量参数,这怎么办?

yumoyi avatar Dec 07 '21 03:12 yumoyi

spring 不是有一个 @PostConstruct 注解吗 ,在这个方法里创建 conf

zhaoche27 avatar Dec 07 '21 08:12 zhaoche27

有没有使用的教程,刚刚百度了一下好像不是不太会用

yumoyi avatar Dec 08 '21 03:12 yumoyi

伪代码:

https://www.cnblogs.com/larryzeal/p/5910149.html

publish class service{ @value("${appId}") private string appId 。。。。

private Config config

@PostConstruct public void run(){ System.out.println(appId); config = Config.createInternalAppSettings(。。。。。) }

public void test(){
  
} 

}

zhaoche27 avatar Dec 08 '21 03:12 zhaoche27