Shiro-SpringBoot icon indicating copy to clipboard operation
Shiro-SpringBoot copied to clipboard

事务失效

Open 1042545965 opened this issue 5 years ago • 1 comments

发现 ShiroConfig 这个系统配置会引起 spring 的 @Transactional 声明式事务失效 。 多次测试 但是没找到具体原因

1042545965 avatar Jan 30 '20 12:01 1042545965

已经找到原因了 , 因为 Shiro 的ShiroFilterFactoryBean实现了FactoryBean接口,所以它会提前被初始化 , 在 ShiroFilter 中有注入了service 这里我没有像作者一样直接使用 mapper ,导致service 没有被spring的 容器注入 ,自然没办法使用 aop 最终导致 在使用这个 service 的声明式事务失效 。

1042545965 avatar Jan 30 '20 12:01 1042545965