The following is a detailed description of spring's Applicationcontext.xml file code: <!--header file, mainly note the code--<?xml version= "1.0" encoding= "UTF-8"?> < ! DOCTYPE beans Public "-//spring//dtd bean//en" "Http://www.springframework.org/dtd/spring-beans.dtd" > <beans > <!--set up data sources--<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource" > <!--database driver, I'm using MySQL database---<property name= "Driverclassname" > <value>com.mysql.jdbc.Driver</value> </property> <!--database address, here also pay attention to coding, otherwise garbled but very depressed oh! --<property name= "url" > <value> jdbc:mysql://localhost:3306/tie?hao947=true&characteren Coding=utf-8 </value> </property> <!--database Username--<property name= "username" > <val Ue>root</value> </property> <!--database Password--<property name= "password" > <value> ;123</value> </property> </bean> <!--inject data sources to session factory--<bean id= "SessioNfactory "class=" Org.springframework.orm.hibernate3.LocalSessionFactoryBean "> <property name=" DataSource " > <ref bean= "DataSource"/> </property> <!--configuration Map file--<property name= "MAPPINGRESOURC Es "> <list> <value>com/hao947/vo/User.hbm.xml</value> </list> </property> </bean> <!--inject the session factory to Hibernatetemplate--and <!-- Explain that Hibernatetemplate:hibernatetemplate provides a number of convenient ways to automatically build Hibernatecallback objects at execution time, such as load (), get (), save, Delete (), and so on. --<bean id= "hibernatetemplate" class= "Org.springframework.orm.hibernate3.HibernateTemplate" > < constructor-arg> <ref local= "sessionfactory"/> </constructor-arg> </bean> <!--inject DAO to Sess Ion Factory--<bean id= "Userdao" class= "Com.hao947.dao.UserDAO" > <property name= "sessionfactory" > <re F bean= "Sessionfactory"/> </property> </bean> <!--inject service to DAO--and < Bean id= "UserService" class= "Com.hao947.service.UserService" > <property name= "Userdao" > <ref local= "us Erdao "/> </property> </bean> <!--inject action to service--<bean name="/user "class=" com.hao947.s Truts.action.UserAction "> <property name=" userservice "> <ref bean=" userservice "/> </property& Gt </bean> </beans>