* 启动provider

dubbo-demo-api-provider

* 启动consumer

dubbo-demo-api-consumer

consumer设置generic

```java
    public static void main(String[] args) {
        ReferenceConfig<DemoService> reference = new ReferenceConfig<>();
        reference.setApplication(new ApplicationConfig("dubbo-demo-api-consumer"));
        reference.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        reference.setInterface(DemoService.class);
        reference.setGeneric(true);
        
        Object obj = reference.get();
        for(Class c : obj.getClass().getInterfaces()) {
            System.err.println(c);
        }
        DemoService service = reference.get();
        String message = service.sayHello("dubbo");
        System.out.println(message);
    }
```

客户端会报错：

```
Exception in thread "main" java.lang.ClassCastException: org.apache.dubbo.common.bytecode.proxy0 cannot be cast to org.apache.dubbo.demo.DemoService
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:42)
```
private static final Class<?>[] INTERNAL_INTERFACES = new Class<?>[]{
            EchoService.class, Destroyable.class
    };
    @Override
    public <T> T getProxy(Invoker<T> invoker) throws RpcException {
        return getProxy(invoker, false);
    }
    @Override
    public <T> T getProxy(Invoker<T> invoker, boolean generic) throws RpcException {
        Set<Class<?>> interfaces = new HashSet<>();
        String config = invoker.getUrl().getParameter(INTERFACES);
        if (config != null && config.length() > 0) {
            String[] types = COMMA_SPLIT_PATTERN.split(config);
            if (types != null && types.length > 0) {
                for (int i = 0; i < types.length; i++) {
                    
                    interfaces.add(ReflectUtils.forName(types[i]));
                }
            }
        }
        if (!GenericService.class.isAssignableFrom(invoker.getInterface()) && generic) {
            interfaces.add(com.alibaba.dubbo.rpc.service.GenericService.class);
        }
        interfaces.add(invoker.getInterface());
        interfaces.addAll(Arrays.asList(INTERNAL_INTERFACES));
        return getProxy(invoker, interfaces.toArray(new Class<?>[0]));
    }
    public abstract <T> T getProxy(Invoker<T> invoker, Class<?>[] types);
}