7

Spring とプロキシの問題についてサポートが必要です。

org.springframework.beans.factory.BeanNotOfRequiredTypeException: 'fooAPIService' という名前の Bean は [com.foo.clientapi.service.FooAPIService] 型である必要がありますが、実際には [com.sun.proxy.$Proxy110] 型でした

org.springframework.beans.factory.BeanCreationException: 'activityController' という名前の Bean の作成中にエラーが発生しました: リソース依存関係の注入に失敗しました。ネストされた例外は org.springframework.beans.factory.BeanNotOfRequiredTypeException: 'fooAPIService' という名前の Bean はタイプ [com.foo.clientapi.service.FooAPIService] である必要がありますが、実際にはタイプ [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 Spring 3.2.2

4

1 に答える 1

11

問題は、同じ ID (名前) を持つ 2 つの Bean (jaxrs:client) があることでした。

于 2014-10-15T01:33:53.627 に答える