aspectJ @AfterReturning没有执行

时间:2015-08-12 14:48:44

标签: spring weblogic aspectj

以下情况:

我在方面类中添加了一些新方法:

public class BulletinLogging extends LoggingServiceImpl {

奇怪的是:“我的”方法没有被执行,类中的其他方法也会被执行。

在互联网上搜索(当然也是这个精彩的网站),但没有找到任何解决方案:(

也许你可以帮忙?

这些是无法执行的方法:

    @AfterReturning(pointcut = "execution(* be.fgov.just.cjr.business.bulletin.BulletinService." +
    "findScannedBulletins(..)) && args (parameters)()", returning = "results", argNames = "parameters, results")
    public void logFindScannedBulletins(ExtractRequestParams parameters, ScannedBulletinsResults results) {
        Assert.notNull(parameters);
        Assert.notNull(results);
        Map<LoggingElementCriteriaTypeEnum, Object> toLogs = new EnumMap<LoggingElementCriteriaTypeEnum, Object>(LoggingElementCriteriaTypeEnum.class);
        toLogs.put(SCANNED_BULLETIN_RN_NR, parameters.getFilterValues().get(ExtractRequestParams.Fields.nationalNumber.toString()));
        toLogs.put(SCANNED_BULLETIN_NUMBER_OF_RESULTS, results.getNumberOfResults());
        log(logMsgCreator.getLogMessage(toLogs), SCANNED_BULLETIN, LIST);
    }

    @AfterReturning(pointcut = "execution(* be.fgov.just.cjr.business.bulletin.BulletinService." +
    "findScannedBulletin(..)) && args (id)()", returning = "bulletin", argNames = "id, bulletin")
    public void logFindScannedBulletin(Long id, ScannedBulletin bulletin) {
        Assert.notNull(id);
        Assert.notNull(bulletin);
        Map<LoggingElementCriteriaTypeEnum, Object> toLogs = new EnumMap<LoggingElementCriteriaTypeEnum, Object>(LoggingElementCriteriaTypeEnum.class);
        toLogs.put(SCANNED_BULLETIN_ID, id);
        toLogs.put(SCANNED_BULLETIN_BULLETIN_ID, bulletin.getBulletin().getId());
        toLogs.put(SCANNED_BULLETIN_DOS_NR, bulletin.getDossier().getDosNrAsString());
        toLogs.put(SCANNED_BULLETIN_PDF_NAME, bulletin.getPdfName());
        log(logMsgCreator.getLogMessage(toLogs), SCANNED_BULLETIN, SEARCH);
    }

    @AfterReturning(pointcut = "execution(* be.fgov.just.cjr.business.bulletin.BulletinService." +
    "getDossierFromScannedConvictionId(..))", returning = "dossier")
    public void logGetDossierFromScannedConvictionId(JoinPoint joinPoint, Dossier dossier) {
        //Assert.notNull(convictionId);
        Assert.notNull(dossier);
        Map<LoggingElementCriteriaTypeEnum, Object> toLogs = new EnumMap<LoggingElementCriteriaTypeEnum, Object>(LoggingElementCriteriaTypeEnum.class);
        toLogs.put(SCANNED_BULLETIN_CONVICTION_ID, joinPoint.getArgs()[0]);
        toLogs.put(SCANNED_BULLETIN_DOS_NR, dossier.getDosNrAsString());
        log(logMsgCreator.getLogMessage(toLogs), SCANNED_BULLETIN, SEARCH);
    }

这些是

的方法
public interface BulletinService {

    public ScannedBulletinsResults findScannedBulletins(ExtractRequestParams parameters);

    ScannedBulletin findScannedBulletin(Long id);

    Dossier getDossierFromScannedConvictionId(String convictionId);

以下实施:

@Transactional
public class BulletinServiceImpl implements BulletinService {

    @Override
    @Transactional(readOnly = true)
    public ScannedBulletinsResults findScannedBulletins(ExtractRequestParams parameters) {
        return bulletinDao.findScannedBulletins(parameters, START_DATE);
    }

    @Override
    @Transactional(readOnly = true)
    public ScannedBulletin findScannedBulletin(Long id) {
        return scannedBulletinDao.findScannedBulletin(id);
    }

    @Override
    @Transactional(readOnly = true)
    public Dossier getDossierFromScannedConvictionId(String convictionId) {
        return findScannedBulletin(Long.parseLong(convictionId)).getDossier();
    }

代码(BulletinServiceImpl)确实被执行(设置断点和东西显示)并且方法本身也按预期工作(所以请告诉我单元测试)

然而,

(方面)方法不会与它们是...的方面的代码一起执行。

任何帮助,非常感谢,

问题/评论以获取进一步的细节......

S上。

0 个答案:

没有答案