]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.webapp/src/main/webapp/WEB-INF/applicationContext.xml
Introduce transaction management
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / WEB-INF / applicationContext.xml
index da1f13900b42c2c9c703d56e0e0dc0ec0cc9f6f4..7858ce7985612ead044e844e29feac3d532b0ba0 100644 (file)
@@ -1,53 +1,44 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"\r
-       default-lazy-init="true">\r
-\r
-       <import\r
-               resource="classpath:/org/argeo/slc/hibernate/spring/applicationContext.xml" />\r
-\r
-       <bean\r
-               class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\r
-               <property name="locations">\r
-                       <value>WEB-INF/local.properties</value>\r
-               </property>\r
-               <property name="properties">\r
-                       <props>\r
-                               <prop key="${dataSourceBean}">\r
-                                       slcTemplates.dataSource.inMemoryTestHSQL\r
-                               </prop>\r
-                       </props>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="sessionFactory"\r
-               parent="slcTemplates.sessionFactory.hibernateBasic">\r
-               <property name="dataSource" ref="${dataSourceBean}" />\r
-               <property name="hibernateProperties">\r
-                       <value><![CDATA[\r
-                               hibernate.dialect=org.hibernate.dialect.HSQLDialect\r
-                               hibernate.hbm2ddl.auto=update\r
-                       ]]></value>\r
-               </property>\r
-       </bean>\r
-\r
-       <bean id="persistentDataSource"\r
-               class="org.springframework.jdbc.datasource.SingleConnectionDataSource"\r
-               destroy-method="destroy">\r
-               <property name="driverClassName" value="org.hsqldb.jdbcDriver" />\r
-               <property name="url" value="${jdbcUrl}" />\r
-               <property name="username" value="sa" />\r
-               <property name="password" value="" />\r
-               <property name="suppressClose" value="true" />\r
-       </bean>\r
-\r
-       <bean id="testResultDao" parent="slcTemplates.dao.testResultDao">\r
-               <property name="sessionFactory" ref="sessionFactory" />\r
-       </bean>\r
-\r
-       <bean id="slcExecutionDao"\r
-               parent="slcTemplates.dao.slcExecutionDao">\r
-               <property name="sessionFactory" ref="sessionFactory" />\r
-       </bean>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
+       <import
+               resource="classpath:/org/argeo/slc/server/spring/servletContext.xml" />
+
+       <import resource="classpath:/org/argeo/slc/server/spring/jmx.xml" />
+
+       <aop:config>
+               <aop:pointcut id="daoProcessMethods"
+                       expression="execution(* org.argeo.slc.dao.process.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice"
+                       pointcut-ref="daoProcessMethods" />
+       </aop:config>
+
+       <aop:config>
+               <aop:pointcut id="daoTestMethods"
+                       expression="execution(* org.argeo.slc.dao.test.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice"
+                       pointcut-ref="daoTestMethods" />
+       </aop:config>
+
+       <aop:config>
+               <aop:pointcut id="daoTestTreeMethods"
+                       expression="execution(* org.argeo.slc.dao.test.tree.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice"
+                       pointcut-ref="daoTestTreeMethods" />
+       </aop:config>
+
+       <tx:advice id="daoAdvice"
+               transaction-manager="transactionManager">
+               <tx:attributes>
+                       <tx:method name="*" propagation="REQUIRED" />
+               </tx:attributes>
+       </tx:advice>
+
+
 </beans>
\ No newline at end of file