Spring定时器调用Hibernate方法没法得到SessionFactory的解决办法

因为在Spring定时器中没法经过注解的方式获取bean,所以须要经过原生的方式获取。获取session的方式以下:
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); 
SessionFactory factory=wac.getBean(SessionFactory.class);
Session session=factory.openSession();
相关文章
相关标签/搜索