web应用部署自动初始化数据库

1. spring配置

<jdbc:initialize-database data-source="dataSource">
  <jdbc:script location="classpath:com/foo/sql/db-schema.sql"/>
  <jdbc:script location="classpath:com/foo/sql/db-test-data.sql"/>
</jdbc:initialize-database>

source: http://docs.spring.io/spring/docs/3.0.0.RC3/reference/html/ch12s09.html

2. 实现ServletContextListener接口

http://hi.baidu.com/qiu_deqing/item/f98fb792930a0dd61e427123


原文地址:https://www.cnblogs.com/qiudeqing/p/3388240.html