文字说明
看文字嫌累的可以查看后面的视频说明((__) ……)
我们可以通过import在一个配置文件中引入其他的配置文件。 例如:
<?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">
<import resource="applicationContext-service.xml"/>
<import resource="applicationContext-dao.xml"/>
<bean id="accountDAO_1" class="com.boxuewa.dk.demo1.dao.AccountDAO"/>
</beans>
这时我们就可以这样创建容器了:
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
视频说明
spring应用手册(第一部分)