We've been working with Archaius 0.x for over 3 years now and have always been very pleased with it.
We're starting a new project so I wanted to update archaius to the latest 2.x version.
However, the API seems to have changed ALOT and i'm really not sure how to adapt to this. First, I haven't been able to understand the new Archaius 2 approach for now. Second, I'm not sure if we can reproduce the same behavior we had with archaius 0.7.5.
Here's what we used:
An empty config.properties file that was just there so that Archaius finds it when we initialize it.
private static DynamicPropertyFactory I = DynamicPropertyFactory.getInstance();
static {
try {
ConfigurationManager.loadAppOverrideProperties("app");
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
String env = ConfigurationManager.getDeploymentContext().getDeploymentEnvironment();
if (env == null) {
String err = "You need to define -Darchaius.deployment.environment=env";
logger.error(err);
throw new RuntimeException(err);
}
else {
logger.info("Environnement: " + env);
}
}
public final DynamicStringProperty name;
private MyConfig(String prefix, IConfig defaultConfig) {
this.name = F.getStringProperty(prefix + "name", defaultConfig.getName());
}
We only use override properties cause that's what works for us. When we pull various project, we also initialized the override with the config from the new project (e.g. ConfigurationManager.loadAppOverrideProperties("app2") to load app2.properties)
What we would like to keep is:
Dynamic properties reloaded at runtime
Possibility to easily override any conf through a couple external URLs (file:// and http://)
Environment-specific configuration files
Can anyone help me with this migration and point me in the right direction ?
I'm also interested in the guice intergration as we're also using it but that's secondary.
Thanks
Hi,
We've been working with Archaius 0.x for over 3 years now and have always been very pleased with it. We're starting a new project so I wanted to update archaius to the latest 2.x version.
However, the API seems to have changed ALOT and i'm really not sure how to adapt to this. First, I haven't been able to understand the new Archaius 2 approach for now. Second, I'm not sure if we can reproduce the same behavior we had with archaius 0.7.5.
Here's what we used:
config.properties
file that was just there so that Archaius finds it when we initialize it.@next=app-user.properties
At runtime we would use
The code would the look like this:
We only use override properties cause that's what works for us. When we pull various project, we also initialized the override with the config from the new project (e.g.
ConfigurationManager.loadAppOverrideProperties("app2")
to loadapp2.properties
)What we would like to keep is:
Can anyone help me with this migration and point me in the right direction ?
I'm also interested in the guice intergration as we're also using it but that's secondary. Thanks