spring配置文件样本

<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:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
	
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation"
			value="classpath:hibernate.cfg.xml">
		</property>
	</bean>

	<!-- 事务处理 -->
	<bean name="HibernateTransactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<tx:annotation-driven transaction-manager="HibernateTransactionManager"/>

	
	<bean id="loginDao" class="crm.cs.dao.impl.LoginDaoImpl">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<bean id="loginMgr" class="crm.cs.mgr.LoginMgr">
		<property name="loginDao" ref="loginDao"></property>
	</bean>
	<!-- 登陆Bean -->
	<bean id="cscrmLoginbeanId" class="crm.cs.action.login.LoginAction"
		scope="prototype">
		<property name="loginMgr" ref="loginMgr"></property>
	</bean>
	<!-- 权限验证Bean -->
	<bean id="securitybeanId" class="crm.cs.action.login.SecurityAction"
		scope="prototype">
	</bean>
    <!-- 查询模板注入 -->
    <bean id="ConsultQueryDao" class="crm.cs.dao.query.impl.ConsultQueryDaoImpl">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<bean id="CustomerQueryDao" class="crm.cs.dao.query.impl.CustomerQueryDaoImpl">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<bean id="MarketManDao" class="crm.cs.dao.query.impl.MarketManDaoImpl">
		<property name="sessionFactory" ref="sessionFactory"></property>
	</bean>

        <!-- 客户管理Bean -->
	<bean id="customerDao" class="crm.cs.dao.impl.CustomerDaoImpl">
	   <property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	
	<!-- 咨询信息管理Bean -->
	<bean id="consultDao" class="crm.cs.dao.impl.ConsultDaoImpl">
	   <property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	
	<!-- 学校信息管理Bean -->
	<bean id="shoolDao" class="crm.cs.dao.impl.SchoolDaoImpl">
	   <property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	
	<!-- 兼职信息管理Bean -->
	<bean id="plurlistDao" class="crm.cs.dao.impl.PlurlistDaoImpl">
	   <property name="sessionFactory" ref="sessionFactory"></property>
	</bean>
	<!-- 基础信息action bean -->
	
	<!-- 客户action Bean -->
	<bean id="customerActionId" class="crm.cs.action.business.CustomerAction">
	     <property name="dao" ref="customerDao"></property>
	</bean>
	<!-- 咨询信息action Bean -->
	<bean id="consultActionId" class="crm.cs.action.business.ConsultAction">
	     <property name="dao" ref="consultDao"></property>
	</bean>
	<!-- 学校信息action Bean -->
	<bean id="shoolActionId" class="crm.cs.action.business.SchoolAction">
	     <property name="dao" ref="shoolDao"></property>
	</bean>
	<!-- 兼职信息action Bean -->
	<bean id="plurlistActionId" class="crm.cs.action.business.PlurlistAction">
	     <property name="dao" ref="plurlistDao"></property>
	</bean>
</beans>

相关推荐