<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/ssh"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/wsw/ssh/model/User.hbm.xml</value></list>
</property>
</bean>
<bean id="userDAOImpl" class="com.wsw.ssh.dao.impl.UserDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="userServiceImpl" class="com.wsw.ssh.service.impl.UserServiceImpl">
<property name="userDAO">
<ref bean="userDAOImpl"/>
</property>
</bean>
<bean id="userAction" class="com.wsw.ssh.action.UserAction">
<property name="userService"> <!--userService 表示在此類中使用userService 對象屬性(還需要get和set方法),而不是userService 類-->
<ref bean="userServiceImpl"/>
</property>
</bean>
</beans>