我们可以使用Spring-AOP摆脱Aspects的bean定义

我们可以使用Spring-AOP摆脱Aspects的bean定义,第1张

概述我的观点如下:@Aspect public class SomeAspect{ //define pointcuts // define Advices pertaining to pointcuts } 我的aspect-config xml文件:<?xml ...?> <beans ... xmlns:aop

我的观点如下:

@Aspectpublic class SomeAspect{    //define pointcuts    // define Advices pertaining to pointcuts}

我的aspect-config xml文件:

这完全没问题

我需要的是:

我想摆脱每个Aspect的写bean定义,如上面的config xml文件中所示.

我尝试了以下方法:

在SomeAspect上添加了@Component,在xml中添加了< context-component-scan>使用包含我的Aspect的相应包,希望我的类被选为Bean和Aspect.
但是,我的看点根本没有被提升.

有什么指针吗?

最佳答案上下文:component-scan元素有一个子元素,您可以使用该子元素包含用于扫描拾取的注释类.

查看上下文:include-filter元素及其属性.

我认为你尝试过的东西会起作用,但如果没有像你那样完全看到它,很难肯定地说. 总结

以上是内存溢出为你收集整理的我们可以使用Spring-AOP摆脱Aspects的bean定义全部内容,希望文章能够帮你解决我们可以使用Spring-AOP摆脱Aspects的bean定义所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: https://outofmemory.cn/langs/1267244.html

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

发表评论

登录后才能评论

评论列表(0条)