Java Code Examples for org.springframework.boot.bind.PropertiesConfigurationFactory#getObject()
The following examples show how to use
org.springframework.boot.bind.PropertiesConfigurationFactory#getObject() .
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: DataSourceAutoConfiguration.java From spring-boot-starter-dao with Apache License 2.0 | 5 votes |
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 2
Source File: GeneratorMain.java From spring-boot-starter-dao with Apache License 2.0 | 5 votes |
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: DubboAutoConfiguration.java From spring-boot-starter-dubbo with Apache License 2.0 | 5 votes |
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); } }