由于在Spring定时器中无法通过注解的方式获取bean,因此需要通过原生的方式获取。获取session的方式如下:
WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); 
SessionFactory factory=wac.getBean(SessionFactory.class);
Session session=factory.openSession();

相关文章:

  • 2021-09-10
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2021-08-14
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-11
  • 2022-12-23
相关资源
相似解决方案