Java Code Examples for com.alibaba.dubbo.config.spring.ReferenceBean#setInterface()
The following examples show how to use
com.alibaba.dubbo.config.spring.ReferenceBean#setInterface() .
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: DubboConsumerAutoConfiguration.java From dubbo-spring-boot-starter with Apache License 2.0 | 5 votes |
/** * init consumer bean * * @param interfaceClazz interfaceClazz * @param reference reference * @return ReferenceBean<T> * @throws BeansException BeansException */ private <T> ReferenceBean<T> getConsumerBean(String beanName, Field field, Reference reference) throws BeansException { ReferenceBean<T> referenceBean = new ReferenceBean<T>(reference); if ((reference.interfaceClass() == null || reference.interfaceClass() == void.class) && (reference.interfaceName() == null || "".equals(reference.interfaceName()))) { referenceBean.setInterface(field.getType()); } Environment environment = this.applicationContext.getEnvironment(); String application = reference.application(); referenceBean.setApplication(this.parseApplication(application, this.properties, environment, beanName, field.getName(), "application", application)); String module = reference.module(); referenceBean.setModule(this.parseModule(module, this.properties, environment, beanName, field.getName(), "module", module)); String[] registries = reference.registry(); referenceBean.setRegistries(this.parseRegistries(registries, this.properties, environment, beanName, field.getName(), "registry")); String monitor = reference.monitor(); referenceBean.setMonitor(this.parseMonitor(monitor, this.properties, environment, beanName, field.getName(), "monitor", monitor)); String consumer = reference.consumer(); referenceBean.setConsumer(this.parseConsumer(consumer, this.properties, environment, beanName, field.getName(), "consumer", consumer)); referenceBean.setApplicationContext(DubboConsumerAutoConfiguration.this.applicationContext); return referenceBean; }
Example 2
Source File: ReferenceBeanBuilder.java From dubbo-2.6.5 with Apache License 2.0 | 3 votes |
private void configureInterface(Reference reference, ReferenceBean referenceBean) { Class<?> interfaceClass = reference.interfaceClass(); if (void.class.equals(interfaceClass)) { interfaceClass = null; String interfaceClassName = reference.interfaceName(); if (StringUtils.hasText(interfaceClassName)) { if (ClassUtils.isPresent(interfaceClassName, classLoader)) { interfaceClass = ClassUtils.resolveClassName(interfaceClassName, classLoader); } } } if (interfaceClass == null) { interfaceClass = this.interfaceClass; } Assert.isTrue(interfaceClass.isInterface(), "The class of field or method that was annotated @Reference is not an interface!"); referenceBean.setInterface(interfaceClass); }