将Spring Batch Admin集成到现有应用程序中 [英] Integrating Spring Batch Admin into an existing application

查看:329
本文介绍了将Spring Batch Admin集成到现有应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Spring Batch和Spring MVC的应用程序.我可以将Spring Batch Admin单独部署,并与我的应用程序使用的数据库一起使用,尽管我希望将其集成到我自己的应用程序中,还可能会修改一些视图.

I have an application which uses Spring Batch and Spring MVC. I am able to deploy Spring Batch Admin as a separate war and use it against the same DB my application uses, though I would like to integrate it into my own application, possibly modify some of the views as well.

是否有一种简单的方法可以执行此操作,或者我必须将其分叉并从那里去吗?

Is there an easy way to do this or do I have to fork it and go from there?

推荐答案

显然,根据

  • web.xml中为Batch Admin定义DispatcherServlet:

    • Define a DispatcherServlet for Batch Admin in web.xml:

    <servlet>
        <servlet-name>Batch Servlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>Batch Servlet</servlet-name>
        <url-pattern>/batch/*</url-pattern>
    </servlet-mapping>
    

  • 在根appContext中为resourceService添加覆盖:

  • Add an override for resourceService in the root appContext:

    <bean id="resourceService"
    class="org.springframework.batch.admin.web.resources.DefaultResourceService">
        <property name="servletPath" value="/batch" />
    </bean> 
    

  • 修改spring-batch-admin-resources-1.2.0-RELEASE.jar中的standard.ftl以反映URL:

  • Modify standard.ftl in spring-batch-admin-resources-1.2.0-RELEASE.jar to reflect the URL:

    <#assign url><@spring.url relativeUrl="${servletPath}/resources/styles/main.css"/></#assign>

    这篇关于将Spring Batch Admin集成到现有应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆