- 浏览: 18591 次
最新评论
文章列表
引用<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http:/ ...
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
...
<1>、利用ClassPathXmlApplicationContext,可以从classpath中读取XML文件
1. //读取一个文件
ApplicationContext context= new ClassPathXmlApplicationContext("applicationContext.xml");
UserDAO userDAO= (UserDAO )context.getBean("userDAO");
2.//读取多个文件
ClassPathXmlApplicationContext r ...