1, introduce spring's jar file
Libs/spring-beans-3.2.2.release.jar
Libs/spring-context-3.2.2.release.jar
Libs/spring-context-support-3.2.2.release.jar
Libs/spring-core-3.2.2.release.jar
Libs/spring-expression-3.2.2.release.jar
Need:
Commons-logging-1.1.1.jar
2. Need to add spring's configuration file
The name of the configuration file can be named casually, but it's best to have practical meaning.
For example:
Spring-dao.xml
Spring-service.xml
Spring.xml
3. How spring configuration files introduce beans constraints
---spring-framework-3.2.2.release-dist/spring-framework-3.2.2.release/docs/spring-framework-reference/html/ Index.html
Table of Contents:
5.2.1. Configuration Metadata Click in
You can copy the original message:
<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
xmlns:xsi= "Http://www.w3.org/2001/XMLSc hema-instance"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springfra mework.org/schema/beans/spring-beans.xsd ">
</beans>
4, the following is an instantiation: container
Read the file parameter dynamic parameters, individual parameters, arrays, and wildcard characters below the classes path
ApplicationContext context = new Classpathxmlapplicationcontext (
"Spring.xml");