Java Code Examples for org.springframework.boot.bind.PropertiesConfigurationFactory#setIgnoreNestedProperties()

The following examples show how to use org.springframework.boot.bind.PropertiesConfigurationFactory#setIgnoreNestedProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EagleBeanFactoryPostProcessor.java    From eagle with Apache License 2.0 6 votes vote down vote up
private EagleConfig getEagleConfig(DefaultListableBeanFactory beanFactory) {
    EagleConfig bean = new EagleConfig();
    Object target = bean;
    PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>(target);
    factory.setPropertySources(deducePropertySources(beanFactory));
    //factory.setValidator(determineValidator(bean));
    factory.setConversionService(conversionService);
    factory.setIgnoreInvalidFields(false);
    factory.setIgnoreUnknownFields(true);
    factory.setIgnoreNestedProperties(false);
    factory.setTargetName("eagle");
    try {
        factory.bindPropertiesToTarget();
    } catch (Exception ex) {
        throw new EagleFrameException(ex);
    }
    return bean;
}
 
Example 2
Source File: DataSourceAutoConfiguration.java    From spring-boot-starter-dao with Apache License 2.0 5 votes vote down vote up
private <T> T getDruidConfig(String prefix, Class<T> claz) {
	PropertiesConfigurationFactory<T> factory = new PropertiesConfigurationFactory<T>(claz);
	factory.setPropertySources(environment.getPropertySources());
	factory.setConversionService(environment.getConversionService());
	factory.setIgnoreInvalidFields(false);
	factory.setIgnoreUnknownFields(true);
	factory.setIgnoreNestedProperties(false);
	factory.setTargetName(prefix);
	try {
		factory.bindPropertiesToTarget();
		return factory.getObject();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
Example 3
Source File: GeneratorMain.java    From spring-boot-starter-dao with Apache License 2.0 5 votes vote down vote up
private <T> T getDruidConfig(String prefix, Class<T> claz) {
	PropertiesConfigurationFactory<T> factory = new PropertiesConfigurationFactory<T>(claz);
	factory.setPropertySources(environment.getPropertySources());
	factory.setConversionService(environment.getConversionService());
	factory.setIgnoreInvalidFields(false);
	factory.setIgnoreUnknownFields(true);
	factory.setIgnoreNestedProperties(false);
	factory.setTargetName(prefix);
	try {
		factory.bindPropertiesToTarget();
		return factory.getObject();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
Example 4
Source File: DubboAutoConfiguration.java    From spring-boot-starter-dubbo with Apache License 2.0 5 votes vote down vote up
private <T> T getPropertiesConfigurationBean(String targetName, Class<T> types) {
	PropertiesConfigurationFactory<T> factory = new PropertiesConfigurationFactory<T>(types);
	factory.setPropertySources(environment.getPropertySources());
	factory.setConversionService(environment.getConversionService());
	factory.setIgnoreInvalidFields(true);
	factory.setIgnoreUnknownFields(true);
	factory.setIgnoreNestedProperties(false);
	factory.setTargetName(targetName);
	try {
		factory.bindPropertiesToTarget();
		return factory.getObject();
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}