Java – beannotofrequiredtypeexception, but it is actually a $proxy type
•
Java
I need help with spring and proxy issues
Webapp project – >
Spring context
<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; ... }
Another project (microservices) – >
FooAPIService. class
@Path("/foos") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public interface FooAPIService { ... }
Jaxrs configuration:
<jaxrs:client id="fooAPIService" address="${toto}" threadSafe="true" serviceClass="com.foo.clientapi.service.FooAPIService" inheritHeaders="true"> ... </jaxrs:client>
Version: aspectjweaver: 1.6 10 aspectjrt:1.6. 11 cglib: 2.2 spring 3.2 two
Solution
The problem is that I have two beans (jaxrs: client) with the same ID (name)
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码