use of org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor in project spring-cloud-function by spring-cloud.
the class FunctionProxyApplicationListener method bind.
private void bind(ConfigurableApplicationContext context) {
ConfigurationPropertiesBindingPostProcessor post = new ConfigurationPropertiesBindingPostProcessor();
post.setBeanFactory(new DefaultListableBeanFactory());
post.setEnvironment(context.getEnvironment());
post.setApplicationContext(new StaticApplicationContext());
try {
post.afterPropertiesSet();
} catch (Exception e) {
throw new IllegalStateException("Cannot bind properties", e);
}
post.postProcessBeforeInitialization(this, getClass().getName());
}
use of org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor in project cas by apereo.
the class CasConfigurationPropertiesEnvironmentManagerTests method verifyOperationByDir.
@Test
public void verifyOperationByDir() throws Exception {
val env = new MockEnvironment();
val dir = FileUtils.getTempDirectory();
env.setProperty(CasConfigurationPropertiesEnvironmentManager.PROPERTY_CAS_STANDALONE_CONFIGURATION_DIRECTORY, dir.getCanonicalPath());
val mgr = new CasConfigurationPropertiesEnvironmentManager(new ConfigurationPropertiesBindingPostProcessor());
assertEquals(dir.getCanonicalPath(), mgr.getStandaloneProfileConfigurationDirectory(env).getCanonicalPath());
}
use of org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor in project cas by apereo.
the class CasConfigurationPropertiesEnvironmentManagerTests method verifyOperationByFile.
@Test
public void verifyOperationByFile() throws Exception {
val env = new MockEnvironment();
val file = File.createTempFile("cas", ".properties");
FileUtils.writeStringToFile(file, "server.port=8899", StandardCharsets.UTF_8);
env.setProperty(CasConfigurationPropertiesEnvironmentManager.PROPERTY_CAS_STANDALONE_CONFIGURATION_FILE, file.getCanonicalPath());
val mgr = new CasConfigurationPropertiesEnvironmentManager(new ConfigurationPropertiesBindingPostProcessor());
assertEquals(file.getCanonicalPath(), mgr.getStandaloneProfileConfigurationFile(env).getCanonicalPath());
}
Aggregations