带有AspectJ的Spring@Transactional被完全忽略

带有AspectJ的Spring@Transactional被完全忽略,第1张

带有AspectJ的Spring / @Transactional被完全忽略

尝试添加

<context:load-time-weaver/>
启用加载时编织,然后将spring-aspects.jar添加到类路径。

有关更多信息,请参见http://static.springsource.org/spring/docs/current/spring-
framework-reference/html/aop.html#aop-aj-ltw-
spring

编辑

对于一般的Java应用程序,即不在Web或应用程序容器中运行的应用程序,您需要通过javaagent选项启用Java工具:

java -javaagent:path/to/spring-instrument.jar your.Main

如果要编织自己的方面,则需要提供带有方面声明的meta-INF / aop.xml文件。(仅在spring方面不是必需的,已经在spring-
aspect.jar中提供了)。

最后,您可以使用Maven Aspectj插件代替编译时编织,例如:

<plugin> <groupId>org.prehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <configuration>     <complianceLevel>1.6</complianceLevel>     <aspectLibraries>         <aspectLibrary>  <groupId>org.springframework</groupId>  <artifactId>spring-aspects</artifactId>         </aspectLibrary>     </aspectLibraries> </configuration> <executions>     <execution>         <goals>  <goal>compile</goal>         </goals>     </execution> </executions>        </plugin>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5623183.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存