标题通过file关键字指定文件在物理绝对路劲
注意这里的file
后面有一个:
,上次我遗漏,然后找了半天…
<bean id="configProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>File:/home/paydubbo/etc/config.properties
</value>
</list>
</property>
</bean>
通过classpath:指定相对路劲
<bean id="configProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:config.properties
</value>
</list>
</property>
</bean>
springboot中通过注解导入xml配置文件
@Configuration
@ImportResource(value = {"classpath:spring-context.xml"})
@ImportResource(value = "file:${workdir}/config/spring-context.xml")