需要 Spring 源工具帮助
我正在 Spring 源工具中应用 AspectJ,
我需要在 Spring 源工具中配置加载时间或编译编织吗?
如果有人提供使用 AspectJ 在 Spring 源工具上应用 Aspect 的详细信息,我将非常高兴
i am applying AspectJ in spring source tool
do i need to configure load time or compile weaving in spring source tool
i will be very happy if any provide details of using AspectJ for applying Aspect on Spring Source Tool
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个非常高级的主题,远远超出了单个 StackOverflow 问题的范围。
基本上:
如果你根本不使用 AspectJ,
但从 AspectJ 创建 Java 代理
注释。这也是最少的
强大的选择。只有几个切入点
得到支持,并且目标必须
是春豆。
AspectJ 编译,你
通常集成到您的构建中
系统(与蚂蚁或
行家)。你的类文件实际上是
更改为包括以下方面。这
称为编译时编织。
其间。你想建议代码,
但你不想改变
类文件,所以你“建议
类加载器”(这不是一个足够的
定义,但它给了你一个
主意)。 Loadtime-weaving 也是
如果你愿意的话,通常是你唯一的选择
将方面添加到第 3 方库
代码。
您应该阅读 Ramnivas Laddad 撰写的AspectJ in Action,以了解所有细微差别。
无论哪种方式,您在 STS 中使用的设置都应该反映您在构建系统中的设置。 7 节。 Spring Reference 中的 Spring 面向方面编程 也非常有帮助。
This is a very advanced topic, way beyond the scope of a single StackOverflow question.
Basically:
where you don't use AspectJ at all,
but create Java proxies from AspectJ
annotations. This is also the least
powerful option. Only a few pointcuts
are supported, and the targets must
be Spring Beans.
AspectJ compilation, which you
usually integrate in your build
system (works fine with ant or
maven). Your class files are actually
changed to include the aspects. This
is called compile-time weaving.
inbetween. You want to advise code,
but you don't want to change the
class files, so you "advise the
classloader" (this is not an adequate
definition, but it gives you an
idea). Loadtime-weaving is also
usually your only choice if you want
to add aspects to 3rd party library
code.
You should read AspectJ in Action by Ramnivas Laddad to understand all the subtle differences.
Either way, the settings you use in STS should reflect the settings you have in your build system. The section 7. Aspect Oriented Programming with Spring from the Spring Reference is also very helpful.