以下 Spring 切入点有什么问题?
Whats wrong with the following Spring PointCut?
我有一个切入点,用于建议在名为 Repository 的接口内声明的方法。但在 运行 时间内,该方面未应用。我的切入点有什么问题?
这里是切入点:-
@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);
}
这是在抽象 class 中实现的:-
@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);
}
你能帮我解决这个问题吗?
方法签名有误,应该是:-
@Around("execution (* *..Repository+.save*(..))" + " && args(entity,..) && target(target)")
public Object cacheEvictOnSaveSingle(
ProceedingJoinPoint proceedingJoinPoint,
Entity<UUID> entity,
RegionRepositoryCassandraImpl target
) {
// ...
}
我有一个切入点,用于建议在名为 Repository 的接口内声明的方法。但在 运行 时间内,该方面未应用。我的切入点有什么问题?
这里是切入点:-
@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);
}
这是在抽象 class 中实现的:-
@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);
}
你能帮我解决这个问题吗?
方法签名有误,应该是:-
@Around("execution (* *..Repository+.save*(..))" + " && args(entity,..) && target(target)")
public Object cacheEvictOnSaveSingle(
ProceedingJoinPoint proceedingJoinPoint,
Entity<UUID> entity,
RegionRepositoryCassandraImpl target
) {
// ...
}