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>
解决方法
原文地址:https://www.jb51.cc/java/120752.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。