Spring的基本配置

阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url"><value>jdbc:mysql://hunan/netschool?useUnicode=true&characterEncoding=gbk</value>
</property><property name="username"><value>netschool</value></property>
<property name="password"><value>123456</value></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>com/aurora/netschool/entity/Administrator.hbm.xml</value>
<value>com/aurora/netschool/entity/Article.hbm.xml</value>
<value>com/aurora/netschool/entity/ClassCategory.hbm.xml</value>
<value>com/aurora/netschool/entity/Category.hbm.xml</value>
<value>com/aurora/netschool/entity/CustomLable.hbm.xml</value>
<value>com/aurora/netschool/entity/KeyWord.hbm.xml</value>
<value>com/aurora/netschool/entity/Template.hbm.xml</value>
<value>com/aurora/netschool/entity/Popedom.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_outer_join">true</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>


<bean name="valueListFactory" class="com.aurora.util.valuelist.ValueListFactory">
<property name="constantsHolder">
<value>com.aurora.netschool.Constants</value>
</property>
</bean>

<bean name="configuration" class="com.aurora.Configuration">
<property name="configureMap">
<props>
<prop key="autoAudit">true</prop>
<prop key="graduateDate">07-08</prop>
</props>
</property>
<property name="directoryMap">
<props>
<prop key="tempDir">/tmp</prop>
<prop key="uploadDir">/upload</prop>
</props>
</property>
</bean>
<bean id="articleDao" class="com.aurora.netschool.dao.impl.ArticleDaoImpl" />
<bean id="administratorDao" class="com.aurora.netschool.dao.impl.AdministratorDaoImpl" />
<bean id="categoryDao" class="com.aurora.netschool.dao.impl.CategoryDaoImpl" />
<bean id="keyWordDao" class="com.aurora.netschool.dao.impl.KeyWordDaoImpl" />
<bean id="templateDao" class="com.aurora.netschool.dao.impl.TemplateDaoImpl" />
<bean id="popedomDao" class ="com.aurora.netschool.dao.impl.PopedomDaoImpl"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="baseTxProxy" abstract="true" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="proxyTargetClass">
<value>true</value>
</property>
</bean>
<bean id="articleService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.ArticleServiceImpl" />
</property>
</bean>
<bean id="administratorService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.AdministratorServiceImpl" />
</property>
</bean>
<bean id="popedomService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.PopedomServiceImpl" />
</property>
</bean>
<bean id="categoryService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.CategoryServiceImpl" />
</property>
</bean>
<bean id="keyWordService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.KeyWordServiceImpl" />
</property>
</bean>
<bean id="templateService" parent="baseTxProxy">
<property name="target">
<bean class="com.aurora.netschool.service.impl.TemplateServiceImpl" />
</property>
</bean>
</beans>

你可能感兴趣的:(Spring,Bean,Hibernate,DAO,XML)