public class DefaultResourceCacheProvider implements ResourceCacheProvider {
private static Log log = LogFactory.getLog(DefaultResourceCacheProvider.class);
public DefaultResourceCacheProvider(){
//添加Hibernate事件监听器,来实现资源缓存的更新
HibernateEventListener.getInstance().addPostUpdateEventListener(new PostUpdateEventListener(){
@Override
public void onPostUpdate(PostUpdateEvent event) {
DefaultResourceCacheProvider.this.clearStaticResouceCache(event.getId().toString(),RestContextManager.getRequest());
}
});