Spring:用于构建数据库并运行App

时间:2017-06-21 08:05:15

标签: java spring spring-mvc servlets

假设我有以下web.xml:

 <servlet>
    <servlet-name>DBbuildServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/DBbuildServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>DBbuildServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/app-context.xml</param-value>
    </init-param>
        <load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>*</url-pattern>
</servlet-mapping>

我想在DBbuildServlet中构建DataBase并推迟appServlet加载,直到DB构建完成。

有可能吗?在使用Spring运行应用程序时构建数据库的正确方法是什么?

0 个答案:

没有答案