BeanNotOfRequiredTypeException due to autowired fields
use interface AdminService
rather than the implements.
this error caused by Annotation @Transactional
, Spring
makes a proxy for AdminService
at Runtime
.
Somewhere in your code you must be autowiring AdminServiceImpl
like this:
@Autowired
private AdminServiceImpl adminService;
Either depend barely on interface:
@Autowired
private AdminService adminService;
or enabled CGLIB proxies.
Similar problems
- Autowired spring bean is not a proxy
- Fixing BeanNotOfRequiredTypeException on Spring proxy cast on a non-singleton bean?
- Getting Spring Error "Bean named 'x' must be of type [y], but was actually of type [$Proxy]" in Jenkins
- Original interface is lost in Spring AOP introduction