| Код | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "../dtd/spring-beans-2.0.dtd"> <beans>
<bean id="PropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>WEB-INF/conf/jdbc.properties</value> <value>WEB-INF/conf/innotex.properties</value> </list> </property> </bean> <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSourceFactory" factory-method="createDataSource" destroy-method="close"> <constructor-arg> <props> <prop key="driverClassName">${jdbc.driverClassName}</prop> <prop key="url">${jdbc.url}</prop> <prop key="username">${jdbc.username}</prop> <prop key="password">${jdbc.password}</prop> <prop key="connectionProperties">useUnicode=true;characterEncoding=utf8</prop> </props> </constructor-arg> </bean> <bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="DataSource"/> <property name="mappingResources"> <list> <value>de/innotex/data/persistent/menu/Level1.hbm.xml</value> <value>de/innotex/data/persistent/menu/Level2.hbm.xml</value> <value>de/innotex/data/persistent/menu/Level3.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> </bean> <bean id="TransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="SessionFactory"/> </bean> <bean id="MenuDao" class="de.innotex.data.dao.MenuDao"> <property name="sessionFactory" ref="SessionFactory"/> </bean>
<bean id="CommonService" class="de.innotex.data.service.CommonService" abstract="true"> <property name="daoHolder"> <bean class="de.innotex.data.dao.DaoHolder"> <constructor-arg ref="MenuDao" index="0"/> </bean> </property> </bean>
<bean id="MenuManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="TransactionManager"/> <property name="target"> <bean class="de.innotex.data.service.MenuService" parent="CommonService"/> </property> <property name="transactionAttributes"> <props> <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="set*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="do*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean>
<bean id="ServiceFactory" class="de.innotex.data.service.ServiceFactory"> <constructor-arg ref="MenuManager" index="0"/> </bean>
<bean id="conf" class="de.innotex.conf.InnotexConfig"> <property name="menuLocation"> <value>${innotex.menulocation}</value> </property> </bean> </beans>
|
держи пример из моего неродившегося веб-проекта, думаю разберешься, что к чему =) Если что - спрашивай, расскажу что да как здесь. |