错误原因
Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
Spring AOP底层自动的使用JDK的动态代理或者CGLIB代理
1:当对象有接口时,使用JDK动态代理
2:当对象没有接口时使用CGLIB代理
解决方案
(1)添加service层接口
(2)或导入cglib jar包
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in file [D:\eclipse-jee-neon-3-win32-x86_64\javaworkspace\hibernate_day01\target\test-classes\cn\tedu\service\UserService.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot p