想做一个防止重复提交的自定义注解,注解实现是用的切面,然后切面实现用@Aspect和@Component注解,
实现如下:
但是切面实现类怎么都进不去,最后大佬朋友给看了下,原来spring和springMVC是两个不同的容器,因为controller是springMVC容器加载的,而VoidRepeatCommitAspectJ是spring容器加载的,是无法互通的,所以AOP未生效。
更改方式:把VoidRepeatCommitAspectJ的生成管理交给springMVC容器。
就是去掉@Component注解,然后在springMVC的配置文件中手动创VoidRepeatCommitAspectJ
然后就好了.........