use of com.kixeye.chassis.bootstrap.configuration.ConfigurationBuilder in project chassis by Kixeye.
the class BootstrapConfiguration method applicationConfiguration.
@Bean
@SuppressWarnings("resource")
public AbstractConfiguration applicationConfiguration() throws ClassNotFoundException {
AppMetadata appMetadata = appMetadata();
ServerInstanceContext serverInstanceContext = serverInstanceContext();
if (appEnvironment == null && serverInstanceContext != null) {
appEnvironment = serverInstanceContext.getEnvironment();
}
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(appMetadata.getName(), appEnvironment, addSystemConfigs, reflections());
configurationBuilder.withConfigurationProvider(configurationProvider());
configurationBuilder.withServerInstanceContext(serverInstanceContext());
configurationBuilder.withApplicationProperties(appMetadata.getPropertiesResourceLocation());
configurationBuilder.withScanModuleConfigurations(scanModuleConfigurations);
configurationBuilder.withAppVersion(appMetadata.getDeclaringClass().getPackage().getImplementationVersion());
AbstractConfiguration configuration = configurationBuilder.build();
if (serverInstanceContext != null) {
serverInstanceContext.setAppName(appMetadata.getName());
serverInstanceContext.setVersion(configuration.getString(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName()));
}
return configuration;
}
use of com.kixeye.chassis.bootstrap.configuration.ConfigurationBuilder in project chassis by Kixeye.
the class ConfigurationBuilderTest method setup.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Before
public void setup() throws Exception {
initializeZookeeper();
configurationBuilder = new ConfigurationBuilder(APP_NAME, ENVIRONMENT, true, BootstrapConfiguration.REFLECTIONS);
configurationBuilder.withAppVersion(APP_VERSION);
TestUtils.resetArchaius();
resetZookeeper();
TestUtils.writePropertiesToFile(TEST_MODULE_CONFIG_PROPERTIES, filesCreated, new SimpleEntry[] { new SimpleEntry(MODULE_1_KEY_1, MODULE_1_VALUE_1), new SimpleEntry(MODULE_1_KEY_2, MODULE_1_VALUE_2), new SimpleEntry(MODULE_1_KEY_3, MODULE_1_VALUE_3) });
TestUtils.writePropertiesToFile(TEST_MODULE_CONFIG_PROPERTIES_2, filesCreated, new SimpleEntry(MODULE_2_KEY_1, MODULE_2_VALUE_1));
}
Aggregations