开发者社区 问答 正文

spring使用自动代理出现的问题?报错

因为某些Bean需要使用ServletContext或ApplicationContext所以实现了相应的Aware接口。

Spring创建Bean时因为实现了接口,会使用jdk创建代理,注入到其它Bean的时候,报错:Bean named 'xxx' must be of type [com.xxx.xxxx] but was actually of type [com.sun.proxy.$Proxy32]

这种情况怎么解决呢?

展开
收起
爱吃鱼的程序员 2020-06-22 17:35:17 558 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    不是很明白,可以贴代码出来

    2020-06-22 17:35:33
    赞同 展开评论
问答分类:
问答地址: