在项目开发的过程中,往往有多个开发人员共同完成一个业务功能,而每个开发人员都拥有属于自己的配置文件applicationContext.xml,于是需要把这些配置文件整合起来,实现项目业务功能,分模块配置就是解决多人开发的协同问题。
主要有以下两种方式进行配置
- 在加载时添加多个配置文件名称
- 配置文件
开发人员张三的配置文件applicationContext.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">
<!--
id:为自己起的名称
class:为类的全路径
init-method:对象创建时调用的初始化方法
destory-method:对象销毁时调用的销毁方法
scope:bean的作用范围,默认为singleton
-->
<!--开发人员张三的配置文件-->
<bean id="userDao" class="com.p