admin管理员组

文章数量:1530040

今天写代码时遇到一个问题,给AService配置事务后运行报错:

Unsatisfied dependency expressed through field 'aService': Bean named 'aService' is expected to be of type [AService] but was actually of type [com.sun.proxy.$Proxy64];

排查发现AService的注入方式是AService aService实体类注入,而不是IAService aService接口注入。
spring的DI是面向接口的,所以在配置事务后需要使用接口注入。

本文标签: 事务SpringService