2016-06-12 34 views
0

我有一個切入點,用於建議在名爲Repository的接口中聲明的方法。但在運行時間方面不適用。我的切入點有什麼問題?以下Spring PointCut有什麼問題?

這裏是切入點: -

@Around("execution (* *..Repository+.save*(..))" + " && args(entity,..) && target(target)") 
    public Object cacheEvictOnSaveSingle(ProceedingJoinPoint proceedingJoinPoint, Region entity, 
      RegionRepositoryCassandraImpl target) { 
} 

和存儲庫接口,如: -

public interface Repository<ENTITY extends Entity<IDENTITY>, IDENTITY extends Serializable, DATAOBJECT> { 

    /** 
    * Find. 
    * 
    * @param id the id 
    * @return the t 
    */ 
    public ENTITY find(IDENTITY id); 

    /** 
    * Save. 
    * 
    * @param entity the entity 
    */ 
    public void save(ENTITY entity); 

    /** 
    * Save async. 
    * 
    * @param entity the entity 
    * @return the result set future 
    */ 
    public ResultSetFuture saveAsync(ENTITY entity); 

    /** 
    * Save. 
    * 
    * @param entity the entity 
    * @param batchStatement the batch statement 
    */ 
    public void save(ENTITY entity, BatchStatement batchStatement); 

    /** 
    * Save. 
    * 
    * @param entities the entities 
    */ 
    public void save(List<ENTITY> entities); 

    /** 
    * Save async. 
    * 
    * @param entities the entities 
    * @return the result set future 
    */ 
    public ResultSetFuture saveAsync(List<ENTITY> entities); 

    /** 
    * Save. 
    * 
    * @param entities the entities 
    * @param batchStatement the batch statement 
    */ 
    public void save(List<ENTITY> entities, BatchStatement batchStatement); 

    /** 
    * Delete. 
    * 
    * @param id the id 
    */ 
    public void delete(IDENTITY id); 

    /** 
    * Delete async. 
    * 
    * @param id the id 
    * @return the result set future 
    */ 
    public ResultSetFuture deleteAsync(IDENTITY id); 

    /** 
    * Delete. 
    * 
    * @param id the id 
    * @param batchStatement the batch statement 
    */ 
    public void delete(IDENTITY id, BatchStatement batchStatement); 

    /** 
    * Delete. 
    * 
    * @param ids the ids 
    */ 
    public void delete(List<IDENTITY> ids); 

    /** 
    * Delete async. 
    * 
    * @param ids the ids 
    * @return the result set future 
    */ 
    public ResultSetFuture deleteAsync(List<IDENTITY> ids); 

    /** 
    * Delete. 
    * 
    * @param ids the ids 
    * @param batchStatement the batch statement 
    */ 
    public void delete(List<IDENTITY> ids, BatchStatement batchStatement); 

} 

這是一個抽象類中實現爲: -

@Override 
    public void save(ENTITY entity) { 
     BatchStatement batchStatement = new BatchStatement(); 
     addEntityToSaveBatch(batchStatement, entity); 

     session.execute(batchStatement); 
    } 

    /* (non-Javadoc) 
    * @see com.byteobject.cloudsanthe.dbclient.repository.Repository#saveAsync(com.byteobject.cloudsanthe.dbclient.dto.compute.Entity) 
    */ 
    @Override 
    public ResultSetFuture saveAsync(ENTITY entity) { 
     BatchStatement batchStatement = new BatchStatement(); 
     addEntityToSaveBatch(batchStatement, entity); 

     return session.executeAsync(batchStatement); 
    } 

    /* (non-Javadoc) 
    * @see com.byteobject.cloudsanthe.dbclient.repository.Repository#save(com.byteobject.cloudsanthe.dbclient.dto.compute.Entity, com.datastax.driver.core.BatchStatement) 
    */ 
    @Override 
    public void save(ENTITY entity, BatchStatement batchStatement) { 
     addEntityToSaveBatch(batchStatement, entity); 
    } 

燦你幫我解決這個問題?

+0

我類擴展上述抽象類: - 公共類RegionRepositoryCassandraImpl延伸EntityRepository <地區,UUID,RegionDO> \t \t器具RegionRepository { –

+0

您是否在Spring AOP中使用基於CGLIB或JDK的代理? –

回答

0

我提出在方法簽名錯誤,它應該是: -

@Around("execution (* *..Repository+.save*(..))" + " && args(entity,..) && target(target)") 
public Object cacheEvictOnSaveSingle(
    ProceedingJoinPoint proceedingJoinPoint, 
    Entity<UUID> entity, 
    RegionRepositoryCassandraImpl target 
) { 
    // ... 
}