chris4dd

Results 1 issues of chris4dd

系统使用了mybatis的插件通用mapper https://github.com/abel533/Mapper 做基类,其他mapper继承这个基类以减少对常规curd的编码。 现在的问题是发现所有基类方法如insert, delete, selectAll 等都无法被拦截,而且如果有方法调用了这些基类方法,也无法被拦截。 定义的注解AuditServiceLog ![ask1](https://user-images.githubusercontent.com/11632864/39976122-91fe9bba-5764-11e8-84af-9502cec5b56f.png) LogAspect ![ask2](https://user-images.githubusercontent.com/11632864/39976130-9aff0362-5764-11e8-9d70-5e4899284486.png) 定义在controller上表现正常 ![ask3](https://user-images.githubusercontent.com/11632864/39976135-a05b4190-5764-11e8-9619-d5384da36c4e.png) 访问对应页面会有日志 ![ask4](https://user-images.githubusercontent.com/11632864/39976139-a530fe08-5764-11e8-9049-6a11734093de.png) 定义在没有调用通用mapper方法的service或者handler方法上也ok ![ask5](https://user-images.githubusercontent.com/11632864/39976141-a93a724a-5764-11e8-8ce2-87923cedaa4d.png) ![ask6](https://user-images.githubusercontent.com/11632864/39976145-aab0412c-5764-11e8-8127-0985bde86a46.png) 而使用了通用mapper方法的则一律没有反应 ![ask7](https://user-images.githubusercontent.com/11632864/39976151-b47fb2f0-5764-11e8-9718-d9f2abc9e049.png) ![ask8](https://user-images.githubusercontent.com/11632864/39976152-b852fd9c-5764-11e8-8cdf-74f3b1d2321f.png) 这里UserService里面调用通用mapper的方法,导致整个UserService上面的方法都不能被拦截。 同时不使用注解直接使用execution语法的方式也尝试过。症状类似,通用mapper的方法被忽略 @Pointcut("execution(* com.hry.spring.mvc.aop.log.service..*.*(..))") aop的配置为springboot默认 ![ask9](https://user-images.githubusercontent.com/11632864/39976159-c331bba4-5764-11e8-88e4-b7fccf152689.png) 有同事使用常规spring mvc(非springboot)通过xml配置的方法,似乎没有特别配置通用mapper就可以被拦截。是这两者有什么区别吗?烦请赐教