Spring Batch管理员在特定路径中搜索配置。此页面说明了它从哪个路径加载资源:
<import resource="classpath*:/meta-INF/spring/batch/bootstrap*.xml"/><import resource="classpath*:/meta-INF/spring/batch/override*.xml"/>
请注意,在Spring Batch Admin发行版中,“覆盖”位置中没有文件。这是供用户添加自己的内容的占位符。
我们设法加载外部属性文件,并在
src/main/resources/meta-INF/spring/batch/override/manager/env-context.xml其中放置xml配置文件,如下所示:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- Use this to set additional properties on beans at run time --> <bean id="placeholderProperties" > <property name="locations"> <list> <value>classpath:/org/springframework/batch/admin/bootstrap/batch.properties</value> <value>classpath:batch-default.properties</value> <value>classpath:batch-${ENVIRONMENT:hsql}.properties</value> <value>classpath:batch-${ENVIRONMENT:mysql}.properties</value> <!-- here we load properties from external config folder --> <value>file:${spring.file.location}</value> </list> </property> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreResourceNotFound" value="false" /> <property name="ignoreUnresolvablePlaceholders" value="false" /> <property name="order" value="1" /> </bean></beans>


