dubboreference注解_@Reference注解不支持泛型注入?

请问下 这个问题解决了吗?我也发送此问题

api:

public interface DemoService {

String sayHello(String name);

}

provider:

@service

public class DemoServiceImpl implements DemoService {

@Value("${dubbo.application.name}")

private String serviceName;

@NacosValue(value = "${spring.aa}", autoRefreshed = true)

private String test;

public String sayHello(String name) {

return String.format("[%s] : Hello, %s", serviceName+test, name);

}

}

consumer:

public class BaseController{@Reference

private S service;

public S getService() {

return service;

}

}

@EnableAutoConfiguration

@RestController

public class DubboConsumerBootstrap extends BaseController{

public static void main(String[] args) {

SpringApplication.run(DubboConsumerBootstrap.class);

}

@RequestMapping(value = "/sayHello", method = GET)

public String sayHello(@RequestParam String name) {

return super.getService().sayHello(name);

}

}

maven 版本:

1.8

2.7.6

2.3.2.RELEASE

Hoxton.RELEASE

2.2.1.RELEASE

2.2.2.RELEASE

org.springframework.boot

spring-boot-dependencies

${spring-boot.version}

pom

import

org.springframework.cloud

spring-cloud-dependencies

${spring-cloud.version}

pom

import

com.alibaba.cloud

spring-cloud-alibaba-dependencies

${spring-cloud-alibaba.version}

pom

import

org.apache.dubbo

dubbo-dependencies-bom

${dubbo.version}

pom

import

org.minbox.framework

api-boot-dependencies

${api-boot.version}

import

pom

org.apache.dubbo

dubbo-spring-boot-starter

${dubbo.version}

consumer报错信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dubboConsumerBootstrap': Injection of @reference dependencies is failed; nested exception is java.lang.IllegalArgumentException: @service interfaceClass() or interfaceName() or interface class must be present!

at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:146) ~[spring-context-support-1.0.6.jar:na]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]

at com.dcy.consumer.DubboConsumerBootstrap.main(DubboConsumerBootstrap.java:26) [classes/:na]

Caused by: java.lang.IllegalArgumentException: @service interfaceClass() or interfaceName() or interface class must be present!

at org.springframework.util.Assert.notNull(Assert.java:201) ~[spring-core-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at org.apache.dubbo.config.spring.util.DubboAnnotationUtils.resolveServiceInterfaceClass(DubboAnnotationUtils.java:122) ~[dubbo-2.7.6.jar:2.7.6]

at org.apache.dubbo.config.spring.util.DubboAnnotationUtils.resolveInterfaceName(DubboAnnotationUtils.java:78) ~[dubbo-2.7.6.jar:2.7.6]

at org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.(ServiceBeanNameBuilder.java:65) ~[dubbo-2.7.6.jar:2.7.6]

at org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBeanNameBuilder.create(ServiceBeanNameBuilder.java:78) ~[dubbo-2.7.6.jar:2.7.6]

at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferencedBeanName(ReferenceAnnotationBeanPostProcessor.java:358) ~[dubbo-2.7.6.jar:2.7.6]

at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInjectedObjectCacheKey(ReferenceAnnotationBeanPostProcessor.java:347) ~[dubbo-2.7.6.jar:2.7.6]

at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.getInjectedObject(AbstractAnnotationBeanPostProcessor.java:354) ~[spring-context-support-1.0.6.jar:na]

at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor$AnnotatedFieldElement.inject(AbstractAnnotationBeanPostProcessor.java:539) ~[spring-context-support-1.0.6.jar:na]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:142) ~[spring-context-support-1.0.6.jar:na]

... 18 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:58069', transport: 'socket'

Process finished with exit code 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值