SOA是大型项目的架构,每个项目之间存在依赖关系,项目中的配置文件也因为这种依赖关系相互加载或被加载
例如下面这个大型项目:(各个项目之间的依赖关系如下)
common中的配置文件
/resources/spring/applicationContext-dubbox.xml
<!-- 加载properties文件-->
<context:property-placeholder location="classpath*:properties/*.properties" />
<!-- 配置连接zookeeper的地址(IP+端口)-->
<dubbo:registry protocol="zookeeper" address="${address}"/>
/resources/properties/dubbox.properties
address=192.168.200.128:2181
<param-value>classpath*:spring/applicationContext*.xml</param-value>
classpath和classpath区别:
classpath: 加载本项目下的指定目录的配置文件
classpath: 加载本项目下和本项目所依赖的所有项目的指定目录下的配置文件
dao中的配置文件
/resources/spring/applicationContext-dao.xml
<!-- 加载properties文件 -->
<context:property-placeholder location="classpath*:properties/*.properties" />
<!-- 配置数据源 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
destroy-method="close">
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="driverClassName" value="${jdbc.driver}" />
<property