- spring在项目初始化时加载类
public class InitDataListener implements InitializingBean, ServletContextAware {
<!-- spring系统启动以后,加载该类,查询所有数据 -->
<bean class="com.zfsoft.listener.init.InitDataListener" />
2.spring加载远程配置文件
<?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:p="http://www.springframework.org/schema/p"
5 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
6
7 <bean id="propertyPlaceholderConfigurer"
8 class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
9
10 <!-- during developing, you can uncomment this to load local properties -->
11 <!-- <property name="location" value="application.properties"/> -->
12
13 <property name="properties">
14 <bean id="remoteProperties" class="org.demo.RemoteProperties"
15 p:url="http://172.21.12*.**/config/dev/application.properties"/>
16 </property>
17 </bean>
18
19 <bean class="org.demo.Foo" p:name="${name}"></bean>
20
21 </beans>
来自博客http://www.cnblogs.com/yjmyzz/p/how-to-load-remote-config-in-spring.html