복붙노트

[SPRING] 일치하는 팩토리 메소드가 없습니다. factory 메소드 'aspectOf ()'

SPRING

일치하는 팩토리 메소드가 없습니다. factory 메소드 'aspectOf ()'

나는 다음과 같은 측면을 가지고있다 :

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 설정 :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
    <aop:aspectj-autoproxy />
    <bean class="trc.suivi.aspects.PliEventManagerAspect" factory-method="aspectOf"/>
 </beans>

내 앱을 시작하면 다음과 같이 표시됩니다.

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 설정이 잘되어야합니다.

아무도 도와 줄 수 있니?

해결법

  1. ==============================

    1.아마도 aspect가 어떤 이유로 컴파일되지 않았기 때문일 것입니다. aspectj weaver plugin에 진단을 추가하고 콘솔에 다음과 같은 내용이 인쇄되어 있는지 확인할 수 있습니까?

    아마도 aspect가 어떤 이유로 컴파일되지 않았기 때문일 것입니다. aspectj weaver plugin에 진단을 추가하고 콘솔에 다음과 같은 내용이 인쇄되어 있는지 확인할 수 있습니까?

    <configuration>
        <outxml>true</outxml>
        <showWeaveInfo>false</showWeaveInfo>
        <Xlint>warning</Xlint>
        <verbose>true</verbose>
                    ...
    </configuration>
    

    또한 raw aspectj를 사용하기 때문에 Spring AOP를 트리거하는 데 사용되는 를 사용할 필요가 없습니다.

  2. ==============================

    2.동일한 오류 메시지가 나타났습니다. 나는 rozky의 대답을 보면서 그것을 해결했다 : http://forum.springsource.org/showthread.php?79928-NoSuchMethodError-Aspect-aspectOf%28%29

    동일한 오류 메시지가 나타났습니다. 나는 rozky의 대답을 보면서 그것을 해결했다 : http://forum.springsource.org/showthread.php?79928-NoSuchMethodError-Aspect-aspectOf%28%29

    답변을 녹음하기 위해 여기에 복사했습니다.

    rozky는 썼다 :

  3. from https://stackoverflow.com/questions/12144606/no-matching-factory-method-found-factory-method-aspectof by cc-by-sa and MIT license