spring原理
一、到github网站上面下载spring的源码:
https://github.com/spring-projects/spring-framework
把下载回来的源码导入到eclipse里面;
二、我把几个spring的文件配置好,如下图:
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" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- 一、hibernate配置 --> <!-- hibernate的sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="configLocation" value="classpath:hibernate.cfg.xml"> </property> </bean> <!-- 定义事务管理器(声明式的事务) --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="transactionBase" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true" abstract="true"> <!-- 配置事务管理器 --> <property name="transactionManager" ref="transactionManager" /> <!-- 配置事务属性 --> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <import resource="daoContext.xml"></import> <!-- 定时任务配置 --> <bean id="statis" class="admin.StatisTask" > <property name="dao" ref="statisDao"></property> </bean> <bean id="hourTask" class="admin.HourTask"> <property name="statisDao" ref="statisDao"></property> </bean> <!-- <bean id="HourTaskListener" class="admin.HourTaskListener"> --> <!-- <property name="hourTask" ref="hourTask"></property> --> <!-- </bean> --> <bean id="statisInsert" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="statis" /> </property> <property name="targetMethod"> <value>insertIntoDBTable</value> <!--此处添加要定时调用的方法名 --> </property> <property name="concurrent" value="false"> </property> </bean> <bean id="triggerStatis" class="org.springframework.scheduling.quartz.CronTriggerBean"> <!-- see the example of method invoking job above --> <property name="jobDetail" ref="statisInsert" /> <!-- 每天凌晨00:00调用一次。 --> <property name="cronExpression" value="00 00 00 * * ?"/> </bean> <!-- 启动前面定义的定时器 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="triggerStatis" /> </list> </property> </bean> <!-- 二、引入DAO的bean配置文件 --> <!-- 三、持久类的bean --> <bean id="advice_send" class="javaBean.Advice_send"></bean> <bean id="person" class="javaBean.Person"></bean> <bean id="company" class="javaBean.Company"></bean> <bean id="parttime_job" class="javaBean.Parttime_job"></bean> <!-- 四、业务逻辑组建的bean --> <!-- 投诉和建议业务逻辑组件的bean --> <bean id="complaintAndAdviceService" class="impl.serviceImpl.web.ComplaintAndAdviceService"> <property name="adviceSendDao" ref="adviceSendDao"></property> <property name="advice_send" ref="advice_send"></property> </bean> <!-- 个人中心模块之我的发布 --> <bean id="myPublishService" class="impl.serviceImpl.web.MyPublishService"> <property name="comParttimeAssDao" ref="comParttimeAssDao"></property> <property name="perParttimeAss3Dao" ref="perParttimeAss3Dao"></property> </bean> <!-- 个人中心模块之企业更新资料 --> <bean id="updateEnterpriseInfoService" class="impl.serviceImpl.web.UpdateEnterpriseInfoService"> <!-- <property name="company" ref="company"></property> --> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 企业上传营业执照 --> <bean id="uploadBusinessLicenseService" class="impl.serviceImpl.web.UploadBusinessLicenseService"> <property name="company" ref="company"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 企业上传协议书 --> <bean id="uploadBusinessProtocolService" class="impl.serviceImpl.web.UploadBusinessProtocolService"> <property name="company" ref="company"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 个人中心模块之查询企业资料 --> <bean id="enterpriseInfoService" class="impl.serviceImpl.web.EnterpriseInfoService"> <property name="company" ref="company"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 个人中心模块之查看我的招聘里的应聘者 --> <bean id="myJobHunterService" class="impl.serviceImpl.web.MyJobHunterService"> <property name="perParttimeAss3Dao" ref="perParttimeAss3Dao"></property> </bean> <!-- 个人中心模块之我的收藏 --> <bean id="myCollectionService" class="impl.serviceImpl.web.MyCollectionService"> <property name="perParttimeAss1Dao" ref="perParttimeAss1Dao"></property> </bean> <!-- 个人中心模块之我的招聘 --> <bean id="myJobService" class="impl.serviceImpl.web.MyJobService"> <property name="perParttimeAss2Dao" ref="perParttimeAss2Dao"></property> </bean> <!-- 个人中心之求职者个人资料 --> <!-- <bean id="jobHunterInfoService" class="impl.serviceImpl.web.JobHunterInfoService"> --> <!-- <property name="personDao" ref="personDao"></property> --> <!-- </bean> --> <!-- 个人中心之注册 --> <bean id="registService" class="impl.serviceImpl.web.RegistService"> <property name="person" ref="person"></property> <property name="company" ref="company"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 个人中心之登陆 --> <bean id="loginService" class="impl.serviceImpl.web.LoginService"> <property name="person" ref="person"></property> <property name="company" ref="company"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 个人中心之修改密码 --> <bean id="changePwdService" class="impl.serviceImpl.web.ChangePwdService"> <property name="person" ref="person"></property> <property name="company" ref="company"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 个人中心之身份认证 --> <bean id="identificationService" class="impl.serviceImpl.web.IdentificationService"> <property name="person" ref="person"></property> <property name="company" ref="company"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 发布招聘 --> <bean id="iPublishJobService" class="impl.serviceImpl.web.PublishJobServiceImpl"> <property name="parttimeJobDao" ref="parttimeJobDao"></property> <property name="comParttimeAssDao" ref="comParttimeAssDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 修改我的发布 --> <bean id="changeMyPublishService" class="impl.serviceImpl.web.ChangeMyPublishService"> <property name="parttime_job" ref="parttime_job"></property> <property name="parttimeJobDao" ref="parttimeJobDao"></property> <!-- <property name="comParttimeAssDao" ref="comParttimeAssDao"></property> --> </bean> <!-- 删除我的收藏 --> <bean id="deleteMyCollectionService" class="impl.serviceImpl.web.DeleteMyCollectionService"> <property name="perParttimeAss1Dao" ref="perParttimeAss1Dao"></property> </bean> <!-- 删除我的招聘 --> <bean id="deleteMyJobService" class="impl.serviceImpl.web.DeleteMyJobService"> <property name="perParttimeAss2Dao" ref="perParttimeAss2Dao"></property> <property name="perParttimeAss3Dao" ref="perParttimeAss3Dao"></property> </bean> <!-- 删除我的发布 --> <bean id="deletePublishService" class="impl.serviceImpl.web.DeletePublishService"> <property name="comParttimeAssDao" ref="comParttimeAssDao"></property> <property name="parttimeJobDao" ref="parttimeJobDao"></property> </bean> <!-- 求职简历 --> <bean id="iResumeService" class="impl.serviceImpl.web.ResumeServiceImpl"> <property name="personDao" ref="personDao"></property> </bean> <!-- 分类导航 --> <bean id="iClassifyGuideService" class="impl.serviceImpl.web.ClassifyGuideServiceImpl"> <property name="parttimeJobDao" ref="parttimeJobDao"></property> <property name="personDao" ref="personDao"></property> <property name="perParttimeAss1Dao" ref="perParttimeAss1Dao"></property> <property name="perParttimeAss2Dao" ref="perParttimeAss2Dao"></property> <property name="perParttimeAss3Dao" ref="perParttimeAss3Dao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <bean id="iJobInfoService" class="impl.serviceImpl.web.JobInfoServiceImpl"> <property name="parttimeJobDao" ref="parttimeJobDao"></property> <property name="perParttimeAss1Dao" ref="perParttimeAss1Dao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- 公告栏 --> <bean id="bulltinBoardService" class="impl.serviceImpl.web.BulltinBoardServiceImpl"> </bean> <!-- 城市列表、区域列表、网站列表、工种列表业务逻辑 --> <bean id="infoListService" class="impl.serviceImpl.web.InfoListService"> <property name="parttimeJobDao" ref="parttimeJobDao"></property> </bean> <!--点击量 --> <bean id="recommanderSystemService" class="impl.serviceImpl.web.RecommanderSystemServiceImpl"> <property name="parttimeAss1Dao" ref="perParttimeAss1Dao"></property> <property name="parttimeAss2Dao" ref="perParttimeAss2Dao"></property> <property name="personDao" ref="personDao"></property> <property name="parttimeJobDao" ref="parttimeJobDao"></property> </bean> <!--scope="prototype"为解题的关键 --> <bean id="domParseService" class="tools.DomParseService" scope="prototype"> </bean> <bean id="forAdminService" class="impl.serviceImpl.web.ForAdminServiceImpl"> <property name="parttimeJobDao" ref="parttimeJobDao"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> <property name="adviceSendDao" ref="adviceSendDao"></property> </bean> <bean id="statisticService" class="impl.serviceImpl.web.StatisticServiceImpl"> <property name="statisDao" ref="statisDao"></property> </bean> <bean id="mapDataService" class="impl.serviceImpl.web.MapDataService" scope="prototype"> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <bean id="adminLoginService" class="impl.serviceImpl.web.AdminLoginServiceImpl" scope="prototype"> <property name="adminDao" ref="adminDao"></property> </bean> <bean id="scanLicenseService" class="impl.serviceImpl.web.ScanLicenseServiceImpl" scope="prototype"> <property name="companyDao" ref="companyDao"></property> </bean> <bean id="webChatService" class="impl.serviceImpl.web.WebChatService"> </bean> <bean id="webMassMailerService" class="impl.serviceImpl.web.MassMailerService"> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> </bean> <!-- zhenchaowen --> <bean id="commentService" class="impl.serviceImpl.web.CommentServiceImpl" scope="prototype"> <property name="commentDao" ref="commentDao"></property> </bean> <!-- zhenchaowen --> <bean id="adsService" class="impl.serviceImpl.web.AdsServiceImpl" scope="prototype"> <property name="adsDao" ref="adsDao"></property> </bean> <!-- zhenchaowen --> <bean id="enrichusService" class="impl.serviceImpl.web.EnrichusServiceImpl" scope="prototype"> <property name="enrichusDao" ref="enrichusDao"></property> </bean> <!-- zhenchaowen --> <bean id="allschoolService" class="impl.serviceImpl.web.AllschoolServiceImpl" scope="prototype"> <property name="allschoolDao" ref="allschoolDao"></property> </bean> <!-- zhenchaowen --> <bean id="aboutappService" class="impl.serviceImpl.web.AboutappServiceImpl" scope="prototype"> <property name="aboutappDao" ref="aboutappDao"></property> </bean> <import resource="filterContext.xml"></import> </beans>
daoContext.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <!-- 配置DAO --> <bean id="daoTemplate" abstract="true" lazy-init="true"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="companyDaoImpl" class="impl.daoImpl.CompanyDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="companyDao" parent="transactionBase" > <property name="target" ref="companyDaoImpl" /> </bean> <bean id="adviceSendDaoImpl" class="impl.daoImpl.AdviceSendDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="adviceSendDao" parent="transactionBase" > <property name="target" ref="adviceSendDaoImpl" /> </bean> <bean id="personDaoImpl" class="impl.daoImpl.PersonDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="personDao" parent="transactionBase" > <property name="target" ref="personDaoImpl" /> </bean> <bean id="parttimeJobDaoImpl" class="impl.daoImpl.ParttimeJobDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="parttimeJobDao" parent="transactionBase" > <property name="target" ref="parttimeJobDaoImpl" /> </bean> <bean id="comParttimeAssDaoImpl" class="impl.daoImpl.ComParttimeAssDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="comParttimeAssDao" parent="transactionBase" > <property name="target" ref="comParttimeAssDaoImpl" /> </bean> <bean id="perParttimeAss1DaoImpl" class="impl.daoImpl.PerParttimeAss1DaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="perParttimeAss1Dao" parent="transactionBase" > <property name="target" ref="perParttimeAss1DaoImpl" /> </bean> <bean id="perParttimeAss2DaoImpl" class="impl.daoImpl.PerParttimeAss2DaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="perParttimeAss2Dao" parent="transactionBase" > <property name="target" ref="perParttimeAss2DaoImpl" /> </bean> <bean id="perParttimeAss3DaoImpl" class="impl.daoImpl.PerParttimeAss3DaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="perParttimeAss3Dao" parent="transactionBase" > <property name="target" ref="perParttimeAss3DaoImpl" /> </bean> <bean id="statisDaoImpl" class="impl.daoImpl.StatisDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="statisDao" parent="transactionBase" > <property name="target" ref="statisDaoImpl" /> </bean> <bean id="adminDaoImpl" class="impl.daoImpl.AdminDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="adminDao" parent="transactionBase" > <property name="target" ref="adminDaoImpl" /> </bean> <bean id="appVersionDaoImpl" class="impl.daoImpl.AppVersionDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="appVersionDao" parent="transactionBase" > <property name="target" ref="appVersionDaoImpl" /> </bean> <bean id="addressDaoImpl" class="impl.daoImpl.AddressDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="addressDao" parent="transactionBase" > <property name="target" ref="addressDaoImpl" /> </bean> <!-- zhenchaowen --> <bean id="commentDaoImpl" class="impl.daoImpl.CommentDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="commentDao" parent="transactionBase"> <property name="target" ref="commentDaoImpl" /> </bean> <!-- zhenchaowen --> <bean id="adsDaoImpl" class="impl.daoImpl.AdsDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="adsDao" parent="transactionBase"> <property name="target" ref="adsDaoImpl" /> </bean> <!-- zhenchaowen --> <bean id="enrichusDaoImpl" class="impl.daoImpl.EnrichusDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="enrichusDao" parent="transactionBase"> <property name="target" ref="enrichusDaoImpl" /> </bean> <!-- zhenchaowen --> <bean id="allschoolDaoImpl" class="impl.daoImpl.AllschoolDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="allschoolDao" parent="transactionBase"> <property name="target" ref="allschoolDaoImpl" /> </bean> <!-- zhenchaowen --> <bean id="aboutappDaoImpl" class="impl.daoImpl.AboutappDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="aboutappDao" parent="transactionBase"> <property name="target" ref="aboutappDaoImpl" /> </bean> <!-- 智能筛选 --> <!-- 原始数据DAO --> <bean id="IntelligenceJobDaoImpl" class="impl.daoImpl.filter.IntelligenceJobDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="IntelligenceJobDao" parent="transactionBase" > <property name="target" ref="IntelligenceJobDaoImpl" /> </bean> <!-- 过滤规则 DAO --> <bean id="AdfilterruleDaoImpl" class="impl.daoImpl.filter.AdfilterruleDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="AdFilterruleDao" parent="transactionBase" > <property name="target" ref="AdfilterruleDaoImpl" /> </bean> <!-- 兼职数据DAO --> <bean id="AdParttimeJobDaoImpl" class="impl.daoImpl.filter.AdParttimeJobDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="AdParttimeJobDao" parent="transactionBase" > <property name="target" ref="AdParttimeJobDaoImpl" /> </bean> <!-- 公司审核层配置 start--> <bean id="AdCompanyDaoImpl" class="impl.daoImpl.filter.AdCompanyDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="AdCompanyDao" parent="transactionBase" > <property name="target" ref="AdCompanyDaoImpl" /> </bean> <bean id="AdAddressDaoImpl" class="impl.daoImpl.filter.AdAddressDaoImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="AdAddressDao" parent="transactionBase" > <property name="target" ref="AdAddressDaoImpl" /> </bean> <!-- 公司审核层配置 end --> </beans>
filterContext.xml:
<?xml version="1.0" encoding="UTF-8"?> <!-- author:成佩涛、彭佳鹏、莫华川 --> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <!-- 业务逻辑层配置 start--> <!-- 智能筛选--> <bean id="AdIntelligenceJobService" class="impl.serviceImpl.filter.IntelligenceJobServiceImpl"> <property name="intelligencejobdao" ref="IntelligenceJobDao"></property> <property name="adFilterruledao" ref="AdFilterruleDao"></property> <property name="parttimejobdao" ref="AdParttimeJobDao"></property> </bean> <!-- 批量导入 --> <bean id="AdBatchInsertJobService" class="impl.serviceImpl.filter.BatchInsertJobServiceImpl"> <property name="intelligencejobdao" ref="IntelligenceJobDao"></property> <property name="personDao" ref="personDao"></property> <property name="companyDao" ref="companyDao"></property> <property name="adviceSendDao" ref="adviceSendDao"></property> </bean> <!-- 单条发布 --> <bean id="AdPublishJobByHandService" class="impl.serviceImpl.filter.AdPublishJobByHandServiceImpl"> <property name="intelligencejobdao" ref="IntelligenceJobDao"></property> <property name="parttimejobdao" ref="AdParttimeJobDao"></property> <property name="addressdao" ref="AdAddressDao"></property> </bean> <!-- 兼职数据 --> <bean id="AdParttimeJobServiceImpl" class="impl.serviceImpl.filter.AdParttimeJobServiceImpl"> <property name="parttimejobdao" ref="AdParttimeJobDao"></property> </bean> <!-- 企业信息审核 --> <bean id="AdCompanyCheckService" class="impl.serviceImpl.filter.AdCompanyCheckServiceImpl"> <property name="companydao" ref="AdCompanyDao"></property> <property name="addressdao" ref="AdAddressDao"></property> </bean> <!-- 过滤规则 --> <bean id="AdFilterruleServiceImpl" class="impl.serviceImpl.filter.AdFilterruleServiceImpl"> <property name="adFilterruledao" ref="AdFilterruleDao"></property> </bean> <!-- 手动过滤 --> <bean id="AdFilterHandServiceImpl" class="impl.serviceImpl.filter.AdFilterHandServiceImpl"> <property name="addressdao" ref="AdAddressDao"></property> <property name="parttimejobdao" ref="AdParttimeJobDao"></property> <property name="intelligencejobdao" ref="IntelligenceJobDao"></property> </bean> <!-- 业务逻辑层配置 end--> <!-- 控制层配置 start--> <!-- 原始数据 --> <bean id="AdIntelligenceAction" class="action.filter.AdIntelligenceAction" scope="prototype"> <property name="intelligencejobservice" ref="AdIntelligenceJobService"></property> </bean> <!-- 兼职数据 --> <bean id="AdParttimeJobAction" class="action.filter.AdParttimeJobAction" scope="prototype"> <property name="parttimejobservice" ref="AdParttimeJobServiceImpl"></property> </bean> <!-- 公司信息审核 --> <bean id="AdCompanyCheckAction" class="action.filter.AdCompanyCheckAction" scope="prototype"> <property name="companycheckservice" ref="AdCompanyCheckService"></property> </bean> <!-- 管理登陆 --> <bean id="AdLoginAction" class="action.filter.AdLoginAction" scope="prototype"> <property name="adminLoginService" ref="adminLoginService"></property> </bean> <!-- 批量导入 --> <bean id="AdUploadFileAction" class="action.filter.AdUploadFileAction" scope="prototype"> <property name="batchInsertJobService" ref="AdBatchInsertJobService"></property> </bean> <!-- 单条发布 --> <bean id="AdPublishJobByHandAction" class="action.filter.AdPublishJobByHandAction" scope="prototype"> <property name="publishJobByHandService" ref="AdPublishJobByHandService"></property> </bean> <!-- 过滤规则 --> <bean id="AdFilterruleAction" class="action.filter.AdFilterruleAction" scope="prototype"> <property name="adfilterruleservice" ref="AdFilterruleServiceImpl"></property> </bean> <!-- 手动过滤 --> <bean id="AdFilterHandAction" class="action.filter.AdFilterHandAction" scope="prototype"> <property name="filterhandservice" ref="AdFilterHandServiceImpl"></property> <property name="intelligencejobservice" ref="AdIntelligenceJobService"></property> </bean> <!-- 控制层配置 end--> </beans>
web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name></display-name> <!-- 解决SSH框架乱码的过滤器 --> <filter> <filter-name>encoding</filter-name> <filter-class>tools.EncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- //session 超时设置 --> <!-- <session-config> --> <!-- <session-timeout>1440</session-timeout> --> <!-- </session-config> --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/webActionApplicationContext.xml, /WEB-INF/daoContext.xml,/WEB-INF/filterContext.xml <!-- ,/WEB-INF/phoneActionApplicationContext.xml --> </param-value> </context-param> <!-- <context-param> <param-name>contextConfigLocation2</param-name> <param-value>/WEB-INF/strutsApplicationContext.xml</param-value> </context-param> --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.xml</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param> <!-- 加载log4j配置文件 --> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- <listener> --> <!-- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> --> <!-- </listener> --> <!-- 统计当前在线人数 --> <listener> <listener-class>admin.OnlineCounterListener</listener-class> </listener> <listener> <listener-class>admin.HourTaskListener</listener-class> </listener> <welcome-file-list> <welcome-file>Homepage.jsp</welcome-file> </welcome-file-list> </web-app>
webActionApplicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?> <!-- author:黄雁仲 --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- 业务控制层Action --> <bean id="webJobListAction" class="action.web.JobListAction" scope="prototype"> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <bean id="webJobInfoAction" class="action.web.JobInfoAction" scope="prototype"> <property name="iJobInfoService" ref="iJobInfoService"></property> </bean> <bean id="webToEmployAction" class="action.web.ToEmployAction" scope="prototype"> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <bean id="webBulltinBoardAction" class="action.web.BulltinBoardAction" scope="prototype"> <property name="bulltinBoardService" ref="bulltinBoardService"></property> </bean> <bean id="webInfoListAction" class="action.web.InfoListAction" scope="prototype"> <property name="infoListService" ref="InfoListService"></property> </bean> <bean id="webRegistAction" class="action.web.RegistAction" scope="prototype"> <property name="registService" ref="registService"></property> </bean> <bean id="webLoginAction" class="action.web.LoginAction" scope="prototype"> <property name="loginService" ref="loginService"></property> </bean> <bean id="webResumeAction" class="action.web.ResumeAction" scope="prototype"> <property name="iResumeService" ref="iResumeService"></property> </bean> <bean name="webResumeInfoAction" class="action.web.ResumeInfoAction" scope="prototype"> <property name="iResumeService" ref="iResumeService"></property> </bean> <bean id="webCommitResumeAction" class="action.web.CommitResumeAction" scope="prototype"> <property name="iResumeService" ref="iResumeService"></property> </bean> <bean id="webJobHunterNumberAction" class="action.web.JobHunterNumberAction" scope="prototype"> <property name="iResumeService" ref="iResumeService"></property> </bean> <bean id="webLatestEnterpriseAction" class="action.web.LatestEnterpriseAction" scope="prototype"> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <!-- 发布招聘 --> <bean id="webPublishApplicationAction" class="action.web.PublishApplicationAction" scope="prototype"> <property name="iPublishJobService" ref="iPublishJobService"></property> </bean> <bean id="webComplaintAndAdviceAction" class="action.web.ComplaintAndAdviceAction" scope="prototype"> <property name="complaintAndAdviceService" ref="complaintAndAdviceService"></property> </bean> <bean id="webMyCollectionAction" class="action.web.MyCollectionAction" scope="prototype"> <property name="myCollectionService" ref="myCollectionService"></property> </bean> <bean id="webMyJobAction" class="action.web.MyJobAction" scope="prototype"> <property name="myJobService" ref="myJobService"></property> </bean> <bean id="webMyPublishAction" class="action.web.MyPublishAction" scope="prototype"> <property name="myPublishService" ref="myPublishService"></property> </bean> <bean id="webJobHunterInfoAction" class="action.web.JobHunterInfoAction" scope="prototype"> <property name="jobHunterInfoService" ref="jobHunterInfoService"></property> </bean> <bean id="webEnterpriseInfoAction" class="action.web.EnterpriseInfoAction" scope="prototype"> <property name="enterpriseInfoService" ref="enterpriseInfoService"></property> </bean> <bean id="webDeleteMyCollectionAction" class="action.web.DeleteMyCollectionAction" scope="prototype"> <property name="deleteMyCollectionService" ref="deleteMyCollectionService"></property> </bean> <bean id="webDeleteMyJobAction" class="action.web.DeleteMyJobAction" scope="prototype"> <property name="deleteMyJobService" ref="deleteMyJobService"></property> </bean> <bean id="webDeleteMyPublishAction" class="action.web.DeleteMyPublishAction" scope="prototype"> <property name="deletePublishService" ref="deletePublishService"></property> </bean> <bean id="webChangePwdAction" class="action.web.ChangePwdAction" scope="prototype"> <property name="changePwdService" ref="changePwdService"></property> </bean> <bean id="webIdentificationAction" class="action.web.IdentificationAction" scope="prototype"> <property name="identificationService" ref="identificationService"></property> </bean> <bean id="webUpdateEnterpriseInfoAction" class="action.web.UpdateEnterpriseInfoAction" scope="prototype"> <property name="updateEnterpriseInfoService" ref="updateEnterpriseInfoService"></property> <property name="enterpriseInfoService" ref="enterpriseInfoService"></property> </bean> <!-- 上传营业执照 --> <bean id="webUploadBusinessLicenseAction" class="action.web.UploadBusinessLicenseAction" scope="prototype"> <property name="uploadBusinessLicenseService" ref="uploadBusinessLicenseService"></property> </bean> <!-- 上传协议书 --> <bean id="webUploadBusinessProtocolAction" class="action.web.UploadBusinessProtocolAction" scope="prototype"> <property name="uploadBusinessProtocolService" ref="uploadBusinessProtocolService"></property> </bean> <bean id="webCollectAction" class="action.web.CollectAction" scope="prototype"> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <bean id="webMyJobHunterAction" class="action.web.MyJobHunterAction" scope="prototype"> <property name="myJobHunterService" ref="myJobHunterService"></property> </bean> <bean id="changeMyPublishAction" class="action.web.ChangeMyPublishAction" scope="prototype"> <property name="changeMyPublishService" ref="changeMyPublishService"></property> </bean> <bean id="downloadAppAction" class="action.web.DownloadAppAction" scope="prototype"> </bean> <bean id="webRecommanderSystemAction" class="action.web.RecommanderSystemAction"> <property name="recommanderSystemService" ref="recommanderSystemService"></property> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <bean id="domParseAction" class="action.web.DomParseAction" scope="prototype"> <property name="domParseService" ref="domParseService"></property> <property name="addressDao" ref="addressDao"></property> </bean> <bean id="modifyXmlAction" class="action.web.ModifyXmlAction"> <property name="domParseService" ref="domParseService"></property> </bean> <bean id="webBatchInsertJobAction" class="action.web.BatchInsertJobAction"> <property name="forAdminService" ref="forAdminService"></property> </bean> <bean id="webSearchAction" class="action.web.SearchAction"> <property name="forAdminService" ref="forAdminService"></property> </bean> <bean id="webDeleteRecordAction" class="action.web.DeleteRecordAction"> <property name="forAdminService" ref="forAdminService"></property> </bean> <bean id="webFuzzyMatchingAction" class="action.web.FuzzyMatchingAction"> <property name="iClassifyGuideService" ref="iClassifyGuideService"></property> </bean> <bean id="webMapDataAction" class="action.web.MapDataAction" scope="prototype"> <property name="mapDataService" ref="mapDataService"></property> </bean> <bean id="webExitAction" class="action.web.ExitAction" scope="prototype"></bean> <bean id="webTopNewsAction" class="action.web.TopNewsAction"> </bean> <bean id="webDownloadImageAction" class="action.web.DownloadImageAction" scope="prototype"> </bean> <bean id="webEditBulletinAction" class="action.web.EditBulletinAction"> <property name="forAdminService" ref="forAdminService"></property> </bean> <bean id="webUploadPhoneImageAction" class="action.web.UploadPhoneImageAction" scope="prototype"> </bean> <bean id="webStatisticAction" class="action.web.StatisticAction" scope="prototype"> <property name="statisticService" ref="statisticService"></property> </bean> <bean id="webAdminLoginAction" class="action.web.AdminLoginAction"> <property name="adminLoginService" ref="adminLoginService"></property> </bean> <bean id="webScanLicenseAction" class="action.web.ScanLicenseAction"> <property name="scanLicenseService" ref="scanLicenseService"></property> </bean> <bean id="webManagePhoneImageAction" class="action.web.ManagePhoneImageAction"> </bean> <bean id="webAppVersionAction" class="action.web.AppVersionAction" scope="prototype"> <property name="appVersionDao" ref="appVersionDao"></property> </bean> <bean id="webChatAction" class="action.web.WebChatAction" scope="prototype"> <property name="webChatService" ref="webChatService"></property> </bean> <bean id="webManageCityAndAreaAction" class="action.web.ManageCityAndAreaAction" scope="prototype"> <property name="addressDao" ref="addressDao"></property> </bean> <bean id="webMassMailerAction" class="action.web.MassMailerAction" scope="prototype"> <property name="massMailerService" ref="webMassMailerService"></property> </bean> <!-- zhenchaowen --> <bean id="CommentAction" class="action.web.CommentAction" scope="prototype"> <property name="commentService" ref="commentService"></property> </bean> <!-- zhenchaowen --> <bean id="AdsAction" class="action.web.AdsAction" scope="prototype"> <property name="adsService" ref="adsService"></property> </bean> <!-- zhenchaowen --> <bean id="EnrichusAction" class="action.web.EnrichusAction" scope="prototype"> <property name="enrichusService" ref="enrichusService"></property> </bean> <!-- zhenchaowen --> <bean id="webUploadAction" class="action.web.UploadAction" scope="prototype"> </bean> <!-- zhenchaowen --> <bean id="webAllschoolAction" class="action.web.AllschoolAction" scope="prototype"> <property name="allschoolService" ref="allschoolService"></property> </bean> <!-- 头像上传 --> <bean id="webHeadPortraitUpLoadAction" class="action.web.HeadPortraitUpLoadAction" scope="prototype"> <property name="iResumeService" ref="iResumeService"></property> </bean> <!-- 关于app --> <bean id="webAboutappAction" class="action.web.AboutappAction" scope="prototype"> <property name="aboutappService" ref="aboutappService"></property> </bean> </beans>
可见我仅仅是在web.xml文件中把几个spring关联的文件配置到一块;
spring实际上将这几者相互关联了在一起
补充列表:
Spring源代码解析(一):IOC容器:http://www.iteye.com/topic/86339
Spring源代码解析(二):IoC容器在Web容器中的启动:http://www.iteye.com/topic/86594
Spring源代码解析(三):Spring JDBC:http://www.iteye.com/topic/87034
Spring源代码解析(四):Spring MVC:http://www.iteye.com/topic/87692
Spring源代码解析(五):Spring AOP获取Proxy:http://www.iteye.com/topic/88187
Spring源代码解析(六):Spring声明式事务处理:http://www.iteye.com/topic/88189
Spring源代码解析(七):Spring AOP中对拦截器调用的实现:http://www.iteye.com/topic/107785
Spring源代码解析(八):Spring驱动Hibernate的实现:http://www.iteye.com/topic/110801
Spring源代码解析(九):Spring Acegi框架鉴权的实现:http://www.iteye.com/topic/112979
Spring源代码解析(十):Spring Acegi框架授权的实现:http://www.iteye.com/topic/11343
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。