Tag Archives: Transaction agent

[Solved] But was actually of type ‘com. Sun. Proxy. $proxy**‘

error:Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named '****' is expected to be of type '****' but was actually of type 'com.sun.proxy.$Proxy**'The solution to the problem.
The code inside my controller is.

@Autowired
private UserServiceImpl userServiceImpl;

The solution is to change the userserviceimpl implementation class to the userservice interface, and that’s it.

After solving the problem, the code is as follows:

@Autowired
private UserService userServiceImpl;

The specific reason is that the interface should be used to receive the proxy object, so as to obtain the proxy object.