您的位置:首页 > 数据库

sessionFactory 生成数据库表

2015-10-05 17:45 357 查看
tomcat 启动时会读取web.xml文件

根据其中的配置:  

  <context-param>

  <param-name>contextConfigLocation</param-name>

  <param-value>classpath*:applicationContext-*.xml</param-value>

  </context-param>

  

  <listener>

  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

  </listener>

1. 首先读取<linstner>...</listener> 中的配置信息,创建ContextLoaderListener 的实例对象

2. 这个实例对象再去读取<context-param>...</context-param>中的配置信息,创建全部bean (比如sessionFactory)的实例,加载到内存中

3. sessionFactory 的实例会根据hibernate 的配置文件hibernate.cfg.xml ,生成对应的数据库表
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: