public class Auditing extends EmptyInterceptor {
@Resource
private ApplicationService applicationService;
public boolean onFlushDirty(Object entity, Serializable id,Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
if(applicationService == null){
System.out.println("applicationService is null");
}
return(true);
}
}
我观察到每个休眠操作都会创建一个新的 Auditing 对象,并且在 onFlushDirty() 中它总是打印“ applicationService is null ”
谁能告诉我如何使 ApplicationService 在 EmptyInterceptor 中可用?