我曾经做过一个使用 spring-batch 和 spring-boot 的项目。
我遵循了如何集成它的确切规则:
1.删除所有@EnableBatchProcessing
2.添加ServletConfiguration和WebappConfiguration(并使用导入它们
@Import({ ServletConfiguration.class, WebappConfiguration.class })
-
添加道具:
批处理-mysql.properties
业务模式 mysql
并将 application.properties 修改为:
server.servletPath=/*
spring.freemarker.checkTemplateLocation=false
ENVIRONMENT=mysql
现在这是副作用。除了 java 配置之外,我的应用程序还使用 applicationContext .xml。
applicationContext 有一些占位符:
<context:property-placeholder
location="file:///etc/location/services/myapp.properties"/>
<bean name="configuration" class="com.mycompany.commons.configuration.factory.BeanAwareConfigurationFactory">
<property name="serviceId" value="${serviceId}"/>
...
</bean>
当我整合后spring-batch-admin
我收到这个错误:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'serviceId' in string value "${serviceId}"
at
...
我尝试使用 @PropertySource 导入它,但它不起作用:
@PropertySource("file:///etc/location/services/myapp.properties")
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
System.out.printf("Started processor service app");
}
当我删除后spring-batch-admin
从我的spring-boot
我设法附加这些道具的项目。
知道如何克服这个问题吗?