我正在使用一个自定义 MVC 应用程序,该应用程序依赖于他们的文档中描述的 SPring Batch,并得到了这个 SO 问题Integrating Spring Batch Admin into an existing application 的帮助。
现在的问题是,当 web 应用程序开始将各种 URL 映射到适当的控制器时,作业配置步骤就会爆炸。
2012-06-04 10:17:54,966 INFO [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] - <Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'>
2012-06-04 10:17:55,512 INFO [org.springframework.ui.freemarker.SpringTemplateLoader] - <SpringTemplateLoader for FreeMarker: using resource loader [WebApplicationContext for namespace 'admin-servlet': startup date [Mon Jun 04 10:17:54 EDT 2012]; parent: Root WebApplicationContext] and template loader path [/WEB-INF/web/]>
2012-06-04 10:17:55,512 INFO [org.springframework.ui.freemarker.SpringTemplateLoader] - <SpringTemplateLoader for FreeMarker: using resource loader [WebApplicationContext for namespace 'admin-servlet': startup date [Mon Jun 04 10:17:54 EDT 2012]; parent: Root WebApplicationContext] and template loader path [classpath:/org/springframework/batch/admin/web/]>
2012-06-04 10:17:55,512 INFO [org.springframework.batch.admin.web.freemarker.HippyFreeMarkerConfigurer] - <ClassTemplateLoader for Spring macros added to FreeMarker configuration>
2012-06-04 10:17:55,528 INFO [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping] - <Mapped URL path [/configuration] onto handler 'configurationHandler'>
2012-06-04 10:17:56,230 INFO [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping] - <Mapped URL path [/job-configuration] onto handler '/job-configuration'>
...
2012-06-04 10:17:56,230 ERROR [org.springframework.web.servlet.DispatcherServlet] - <Context initialization failed>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/job-configuration.json': Cannot resolve reference to bean 'job-configurations' while setting bean property 'requestChannel'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'job-configurations' is defined
有人遇到这种情况吗?该应用程序依赖于一个完全独立工作的简单 spring-batch jar,我希望它能够从该工件中提取任何需要的作业 bean。