<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
	
	<!--配数据源 -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost:3306/disk?characterEncoding=UTF-8" />
		<property name="username" value="root" />
		<property name="password" value="1970" />
	</bean>
	
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation"
			value="classpath:hibernate.cfg.xml">
		</property>
	</bean>
	<bean id="hibernateTemplate"
		class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>


	<bean id="transactionInterceptor"
		class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager">
			<ref bean="transactionManager" />
		</property>
		<property name="transactionAttributes">
			<props>
				<prop key="get*">PROPAGATION_REQUIRED, readOnly</prop>
				<prop key="getDirInfo">PROPAGATION_REQUIRED</prop>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	<bean
		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<property name="beanNames">
			<list>
				<value>userDAO</value>
				<value>directoryDAO</value>
				<value>fileDAO</value>
			</list>
		</property>
		<property name="interceptorNames">
			<list>
				<value>transactionInterceptor</value>
			</list>
		</property>
	</bean>
	<bean id="userDAO" class="dao.UserDAOImpl">
		<constructor-arg>
			<ref bean="hibernateTemplate" />
		</constructor-arg>
	</bean>
	<bean id="directoryDAO" class="dao.DirectoryDAOImpl">
		<constructor-arg>
			<ref bean="hibernateTemplate" />
		</constructor-arg>
	</bean>
	<bean id="fileDAO" class="dao.FileDAOImpl">
		<constructor-arg>
			<ref bean="hibernateTemplate" />
		</constructor-arg>
	</bean>

	<bean id="userService" class="service.UserServiceImpl">
		<constructor-arg>
			<ref bean="userDAO" />
		</constructor-arg>
	</bean>
	<bean id="directoryService" class="service.DirectoryServiceImpl">
		<constructor-arg>
			<ref bean="directoryDAO" />			
		</constructor-arg>
		<constructor-arg>
			<ref bean="fileDAO" />
		</constructor-arg>
	</bean>
	<bean id="fileService" class="service.FileServiceImpl">
		<constructor-arg>
			<ref bean="fileDAO" />
		</constructor-arg>
	</bean>
	<bean id="serviceManager" class="service.ServiceManager">
		<property name="userService">
			<ref bean="userService" />
		</property>
		<property name="directoryService">
			<ref bean="directoryService" />
		</property>
		<property name="fileService">
			<ref bean="fileService" />
		</property>
	</bean>
	<bean
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location">
			<value>WEB-INF\netdisk.properties</value>
		</property>
	</bean>


	<bean id="userInfo" class="common.UserInfo" scope="prototype">
		<property name="root" value="${disk.root}" />
	</bean>

</beans>