public static <T> T createPropertiesConfiguration(Class<T> clazz, String prefix, Map<String, String> propMap) {

        T targetObj;
        try {
            targetObj = clazz.newInstance();
        } catch (Exception e) {
            throw new IllegalStateException(clazz.getName() + " instance error", e);
        }

        AutoConfigContext configContext = new AutoConfigContextBuilder()
                .setPrefix(prefix)
                .setPropMap(propMap)
                .setTargetObj(targetObj)
                .build();

        Set<String> includeNames = new HashSet<String>();
        if (CollectionUtils.isNotEmpty(configContext.getNameDescriptorMap())) {
            for (String key : propMap.keySet()) {
                for (String name : configContext.getNameDescriptorMap().keySet()) {
                    if (key.startsWith(name)) {
                        includeNames.add(name);
                    }
                }
            }
        }

        for (String includeName : includeNames) {
            PropertyDescriptor descriptor = configContext.getNameDescriptorMap().get(includeName);
            Class<?> propertyType = descriptor.getPropertyType();
            Resolver resolver = ResolverUtils.getResolver(propertyType);
            if (resolver != null) {
                resolver.resolve(configContext, descriptor, propertyType);
            } else {
                throw new PropertiesConfigurationResolveException("Can not find Resolver for type:" + propertyType.getName());
            }
        }
        return targetObj;
    }
@author Robert HG (254963746@qq.com) on 4/18/16.
lts-core/src/main/java/com/github/ltsopensource/autoconfigure/PropertiesConfigurationFactory.java