我有以下几个方面:
package trc.suivi.aspects;
import java.util.Date;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import trc.suivi.domain.EvenementPli;
import trc.suivi.domain.Pli;
import trc.suivi.domain.TypeEvenement;
import trc.suivi.repository.EvenementPliRepository;
public aspect PliEventManagerAspect {
private static final Logger log = Logger.getLogger(PliEventManagerAspect.class);
@Autowired
private EvenementPliRepository evenementPliRepository;
public PliEventManagerAspect() {
}
pointcut catchEMPersist(Pli pli) : (execution(* trc.suivi.repository.PliRepository+.save(*)) && args(pli));
pointcut catchEMPersist() : (execution(trc.suivi.domain.Pli.persist()));
after(Pli pli) returning: catchEMPersist(pli) {
log.debug("catchEMPersist(pli)");
EvenementPli ev = new EvenementPli();
ev.setDateCreation(new Date());
ev.setType(TypeEvenement.creation);
ev.setMessage("Création d'un pli");
evenementPliRepository.save(ev);
}
after() returning: catchEMPersist() {
log.debug("catchEMPersist()");
EvenementPli ev = new EvenementPli();
ev.setDateCreation(new Date());
ev.setType(TypeEvenement.creation);
ev.setMessage("Création d'un pli");
evenementPliRepository.save(ev);
}
}
以下xml配置:
spring-beans-3.1.xsd">
utoproxy />
当我启动我的应用程序时,我得到了这个:
No matching factory method found: factory method 'aspectOf()'. Check that a method with the specified name exists and that it is static.
我非常傻眼,因为我很确定此配置之前工作正常.更重要的是Spring Roo项目所以所有aspectJ配置都应该没问题.
有人可以帮忙吗?
最佳答案
这可能是因为您的方面由于某种原因没有编译,您可以尝试向您的aspectj weaver插件添加更多诊断,并查看控制台上正在打印的内容,沿着这些方向:
figuration>
weaveInfo>falseweaveInfo>
figuration>
此外,由于您使用的是raw aspectj,因此您并不需要使用< aop:aspectj-autoproxy />用于触发Spring AOP.
原文地址:https://www.jb51.cc/spring/432736.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。