yinhaox opened a new issue, #4560:
URL: https://github.com/apache/servicecomb-java-chassis/issues/4560
我想使用org.apache.commons.configuration2作为动态配置源
为此我写了个简单的demo:
```java
public class MyDynamicPropertiesSource implements DynamicPropertiesSource {
@Override
public MapPropertySource create(Environment environment) {
Parameters params = new Parameters();
File propertiesFile = new File("config.properties");
ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration>
builder =
new
ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
.configure(params.fileBased().setFile(propertiesFile));
PeriodicReloadingTrigger trigger = new
PeriodicReloadingTrigger(builder.getReloadingController(), null, 15,
TimeUnit.SECONDS);
trigger.start();
try {
return new ConfigurationPropertySource("local",
builder.getConfiguration());
} catch (ConfigurationException e) {
throw new RuntimeException(e);
}
}
@Override
public int getOrder() {
return 0;
}
}
```
ConfigurationPropertySource是configuration2提供的Spring PropertySources
但是DynamicPropertiesSource接口只支持返回MapPropertySource。
是否可以修改DynamicPropertiesSource接口里返回值的定义为PropertySource<?>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]