java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to org.andrea.myexample.myDeclarativeTransactionSpring.StudentJDBCTemplate

后端 未结 4 1546
[愿得一人]
[愿得一人] 2021-02-10 01:49

I am trying to implement this tutorial about Declarative Transaction in Spring Framework application but don\'t work because when I try to execute the MainApp c

4条回答
  •  终归单人心
    2021-02-10 02:25

    You should use the interface type in aop pointcut expression i.e in following line:-

    expression="execution(* org.andrea.myexample.myDeclarativeTransactionSpring.StudentJDBCTemplate.create(..))" />
    

    use the below code:-

    expression="execution(* org.andrea.myexample.myDeclarativeTransactionSpring.StudentDAO.create(..))" />
    

    Spring supports AOP via proxying which is of two type Interface based (Proxy implements all the interfaces implemented by target class) and Class based ( achieved by subclassing the target class).

提交回复
热议问题