<?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.0.xsd">
<!-- 使用JNDI数据源 -->
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"
value="java:comp/env/jdbc/news"></property>
</bean>
<!-- 管理Hibernate -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"
ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>org/bulktree/ssh2/news/vo/User.hbm.xml</value>
<value>org/bulktree/ssh2/news/vo/News.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
</value>
</property>
</bean>
<bean id="userdao"
class="org.bulktree.ssh2.news.dao.impl.UserDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!--
bean配置 -->
<bean id="newsdao"
class="org.bulktree.ssh2.news.dao.impl.NewsDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="userservice"
class="org.bulktree.ssh2.news.service.impl.UserServiceImpl">
<property name="userDao">
<ref bean="userdao"/>
</property>
</bean>
<bean id="newservice"
class="org.bulktree.ssh2.news.service.impl.NewsServiceImpl">
<property name="newsDao">
<ref bean="newsdao"/>
</property>
</bean>
<bean id="loginAction"
class="org.bulktree.ssh2.news.action.LoginAction">
<property name="userService">
<ref bean="userservice"/>
</property>
</bean>
<bean id="registAction"
class="org.bulktree.ssh2.news.action.RegistAction">
<property name="userService">
<ref bean="userservice"/>
</property>
</bean>
<bean id="noticeAction"
class="org.bulktree.ssh2.news.action.NoticeNewsAction">
<property name="newsService">
<ref bean="newservice"/>
</property>
</bean>
<bean id="listallAction"
class="org.bulktree.ssh2.news.action.QueryAllNews">
<property name="newsDao">
<ref bean="newsdao"/>
</property>
</bean>
</beans>
|