java – BeanNotOfRequiredTypeException但实际上是$Proxy类型

我需要帮助解决 Spring和代理问题.

org.springframework.beans.factory.BeanNotOfrequiredTypeException: Bean named ‘fooAPIService’ must be of type [com.foo.clientapi.service.FooAPIService],but was actually of type [com.sun.proxy.$Proxy110]

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘activityController’: Injection of resource dependencies Failed; nested exception is org.springframework.beans.factory.BeanNotOfrequiredTypeException: Bean named ‘fooAPIService’ must be of type [com.foo.clientapi.service.FooAPIService],but was actually of type [com.sun.proxy.$Proxy110]

Webapp项目 – >

春天上下文

<context:annotation-config/>
<context:component-scan base-package="com.foo.controller"/>
<aop:aspectj-autoproxy />
<aop:config proxy-target-class="true"/>
<mvc:annotation-driven/>

ActivityController.class

import com.foo.clientapi.service.FooAPIService;
...

@Controller
@RequestMapping(value = "/toto")
public class ActivityController {

@Resource
private FooAPIService fooAPIService;

...
}

一个项目(微服务) – >

FooAPIService.class

@Path("/foos")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface FooAPIService {

...
}

Jaxrs配置:

<jaxrs:client id="fooAPIService"
              address="${toto}"
              threadSafe="true"
              serviceClass="com.foo.clientapi.service.FooAPIService"
              inheritHeaders="true">
    ...
</jaxrs:client>

版本:
aspectjweaver:1.6.10
aspectjrt:1.6.11
cglib:2.2
春天3.2.2

解决方法

问题是我有两个具有相同id(名称)的bean(jaxrs:client).

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...