2016-06-12 32 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 
) { 
    // ... 
}