自定义Spring-boot的starter实现AOP记录用户的操作,在其他微服务引用时为什么不起作用

1.在common模块中自定义注解,定义切面类等

 

 

2.在testAop服务中引入该项目依赖后使用,但是不起作用。

 

 原因:testAOPt模块启动时没把common模块下自定义注解,切面类扫描进ioc容器

解决办法:在testAOP模块中定义AOPconfig, 启动AOP服务时扫描common包下的相关内容

 

3. 无法使用mapper.xml,只能使用注解例如@Select等

报错org.apache.ibatis.binding.BindingException: Type interface com.xxxx.commonutils.mapper.SLAMapper is not known to the MybatisPlusMapperRegistry.

或者

原因:容器未扫描到mapper.xml文件

解决办法:使用注解  @MapperScan,其中com.xxxx,yyyy.mapper目录下有dao层文件和mapper.xml文件

 

 

posted @ 2021-07-07 11:23  rookie_ray  阅读(424)  评论(1编辑  收藏  举报