DatabaseMigrateContextListener.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:ix3 作者:
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
    WebApplicationContext webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContextEvent.getServletContext());
    AutowireCapableBeanFactory autowireCapableBeanFactory=webApplicationContext.getAutowireCapableBeanFactory();
    autowireCapableBeanFactory.autowireBean(this);

    //Permitirmos varias "locations" en el parámetro separados por "\n"
    String[] rawLocations = (servletContextEvent.getServletContext().getInitParameter("databasemigration.location")+"").split("\\n");
    List<String> locations = new ArrayList<String>();
    for(String location : rawLocations) {
        if ((location!=null) && (location.trim().isEmpty()==false)) {
            locations.add(location);
        }
    }

    databaseMigration.migrate(locations);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号