Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 3 | xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" |
| 4 | xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 5 | xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" |
| 6 | xmlns:cache="http://www.springframework.org/schema/cache" |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 7 | xsi:schemaLocation="http://www.springframework.org/schema/beans |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 8 | http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
| 9 | http://www.springframework.org/schema/tx |
| 10 | http://www.springframework.org/schema/tx/spring-tx-4.0.xsd |
| 11 | http://www.springframework.org/schema/aop |
| 12 | http://www.springframework.org/schema/aop/spring-aop-4.0.xsd |
| 13 | http://www.springframework.org/schema/context |
| 14 | http://www.springframework.org/schema/context/spring-context-4.0.xsd |
| 15 | http://www.springframework.org/schema/util |
| 16 | http://www.springframework.org/schema/util/spring-util-4.0.xsd"> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 17 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 18 | <context:component-scan base-package="de.ids_mannheim.korap" /> |
| 19 | <context:annotation-config /> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 20 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 21 | <bean id="props" |
| 22 | class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
| 23 | <property name="ignoreResourceNotFound" value="true" /> |
| 24 | <property name="locations"> |
| 25 | <array> |
margaretha | 0c47c65 | 2017-04-19 18:44:40 +0200 | [diff] [blame] | 26 | <value>classpath:kustvakt-test.conf</value> |
| 27 | <value>file:./kustvakt-test.conf</value> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 28 | </array> |
| 29 | </property> |
| 30 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 31 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 32 | <bean id="placeholders" |
| 33 | class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 34 | <property name="ignoreResourceNotFound" value="true" /> |
| 35 | <property name="locations"> |
| 36 | <array> |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 37 | <value>classpath:test-jdbc.properties</value> |
margaretha | 1f106f6 | 2017-10-18 22:27:30 +0200 | [diff] [blame] | 38 | <value>file:./test-jdbc.properties</value> |
margaretha | f6d5a82 | 2017-10-19 19:51:20 +0200 | [diff] [blame^] | 39 | <value>classpath:test-hibernate.properties</value> |
margaretha | f18298b | 2017-09-14 22:14:32 +0200 | [diff] [blame] | 40 | <value>classpath:kustvakt-test.conf</value> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 41 | </array> |
| 42 | </property> |
| 43 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 44 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 45 | <bean id='cacheManager' class='org.springframework.cache.ehcache.EhCacheCacheManager' |
| 46 | p:cacheManager-ref='ehcache' /> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 47 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 48 | <bean id='ehcache' |
| 49 | class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean' |
| 50 | p:configLocation='classpath:ehcache.xml' p:shared='true' /> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 51 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 52 | <!-- props are injected from default-config.xml --> |
| 53 | <bean id="kustvakt_config" class="de.ids_mannheim.korap.config.KustvaktConfiguration"> |
margaretha | f68daa6 | 2017-09-21 02:11:24 +0200 | [diff] [blame] | 54 | <constructor-arg name="properties" ref="props" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 55 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 56 | |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 57 | <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" |
| 58 | lazy-init="true"> |
| 59 | <property name="driverClassName" value="${jdbc.driverClassName}" /> |
| 60 | <property name="url" value="${jdbc.url}" /> |
| 61 | <property name="username" value="${jdbc.username}" /> |
| 62 | <property name="password" value="${jdbc.password}" /> |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 63 | <property name="maxTotal" value="1" /> |
| 64 | <property name="maxIdle" value="1" /> |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 65 | <property name="minIdle" value="1" /> |
| 66 | <property name="maxWaitMillis" value="15000" /> |
| 67 | <!--<property name="poolPreparedStatements" value="true"/> --> |
| 68 | </bean> |
| 69 | |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 70 | <!-- use SingleConnection only for testing! --> |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 71 | <bean id="sqliteDataSource" |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 72 | class="org.springframework.jdbc.datasource.SingleConnectionDataSource" |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 73 | lazy-init="true" destroy-method="destroy"> |
| 74 | <!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> --> |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 75 | <property name="url" value="${jdbc.url}" /> |
| 76 | <property name="username" value="${jdbc.username}" /> |
| 77 | <property name="password" value="${jdbc.password}" /> |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 78 | <!-- Sqlite can only have a single connection --> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 79 | <property name="suppressClose"> |
| 80 | <value>true</value> |
| 81 | </property> |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 82 | </bean> |
| 83 | |
| 84 | <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" |
| 85 | destroy-method="close"> |
| 86 | <property name="driverClass" value="${jdbc.driverClassName}" /> |
| 87 | <property name="jdbcUrl" value="${jdbc.url}" /> |
| 88 | <property name="user" value="${jdbc.username}" /> |
| 89 | <property name="password" value="${jdbc.password}" /> |
| 90 | <property name="maxPoolSize" value="1" /> |
| 91 | <property name="minPoolSize" value="1" /> |
| 92 | <property name="maxStatements" value="1" /> |
| 93 | <property name="testConnectionOnCheckout" value="true" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 94 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 95 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 96 | <!-- to configure database for sqlite, mysql, etc. migrations --> |
| 97 | <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate"> |
margaretha | f6d5a82 | 2017-10-19 19:51:20 +0200 | [diff] [blame^] | 98 | <!-- drop existing tables and create new tables --> |
| 99 | <property name="validateOnMigrate" value="true" /> |
| 100 | <property name="cleanOnValidationError" value="true" /> |
| 101 | |
margaretha | 514e141 | 2017-10-10 15:54:20 +0200 | [diff] [blame] | 102 | <property name="baselineOnMigrate" value="false" /> |
| 103 | <property name="locations" value="${jdbc.schemaPath}" /> |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 104 | <property name="dataSource" ref="sqliteDataSource" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 105 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 106 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 107 | <bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient"> |
margaretha | bc9caf4 | 2017-09-21 18:52:52 +0200 | [diff] [blame] | 108 | <constructor-arg index="0" ref="sqliteDataSource" /> |
| 109 | <property name="database" value="sqlite" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 110 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 111 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 112 | <bean id="entityManagerFactory" |
| 113 | class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> |
| 114 | <property name="dataSource" ref="dataSource" /> |
| 115 | <property name="packagesToScan" value="de.ids_mannheim.korap.entity" /> |
| 116 | <property name="jpaVendorAdapter"> |
| 117 | <bean id="jpaVendorAdapter" |
| 118 | class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> |
| 119 | <property name="databasePlatform" value="${hibernate.dialect}" /> |
| 120 | </bean> |
| 121 | </property> |
| 122 | <property name="jpaProperties"> |
| 123 | <props> |
| 124 | <prop key="hibernate.dialect">${hibernate.dialect}</prop> |
| 125 | <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> |
| 126 | <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> |
| 127 | <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> |
| 128 | <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache} |
| 129 | </prop> |
| 130 | <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop> |
| 131 | <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop> |
| 132 | <!-- <prop key="net.sf.ehcache.configurationResourceName">classpath:ehcache.xml</prop> --> |
| 133 | </props> |
| 134 | </property> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 135 | </bean> |
Michael Hanl | e4fc775 | 2016-02-17 11:41:18 +0100 | [diff] [blame] | 136 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 137 | <tx:annotation-driven proxy-target-class="true" |
| 138 | transaction-manager="transactionManager" /> |
| 139 | <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> |
| 140 | <property name="entityManagerFactory" ref="entityManagerFactory" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 141 | </bean> |
Michael Hanl | e4fc775 | 2016-02-17 11:41:18 +0100 | [diff] [blame] | 142 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 143 | <bean id="transactionTemplate" |
| 144 | class="org.springframework.transaction.support.TransactionTemplate"> |
| 145 | <constructor-arg ref="transactionManager" /> |
| 146 | </bean> |
| 147 | |
| 148 | <!-- Data access objects --> |
| 149 | <bean id="resourceDao" class="de.ids_mannheim.korap.dao.ResourceDao"/> |
| 150 | <!-- <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao"/> --> |
| 151 | |
margaretha | 6c2a20f | 2017-07-24 15:33:01 +0200 | [diff] [blame] | 152 | <!-- Krill --> |
| 153 | <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill"> |
| 154 | <constructor-arg value="${krill.indexDir}"/> |
| 155 | </bean> |
| 156 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 157 | <bean id="kustvakt_auditing" class="de.ids_mannheim.korap.handlers.JDBCAuditing"> |
| 158 | <constructor-arg ref="kustvakt_db" /> |
| 159 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 160 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 161 | <bean id="kustvakt_userdb" class="de.ids_mannheim.korap.handlers.EntityDao"> |
| 162 | <constructor-arg ref="kustvakt_db" /> |
| 163 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 164 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 165 | <bean id="kustvakt_admindb" class="de.ids_mannheim.korap.handlers.AdminDao"> |
| 166 | <constructor-arg ref="kustvakt_db" /> |
| 167 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 168 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 169 | <bean id="resource_provider" class="de.ids_mannheim.korap.handlers.ResourceDao"> |
| 170 | <constructor-arg ref="kustvakt_db" /> |
| 171 | </bean> |
Michael Hanl | f8fcc7a | 2016-06-03 17:41:07 +0200 | [diff] [blame] | 172 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 173 | <bean id="document_provider" class="de.ids_mannheim.korap.handlers.DocumentDao"> |
| 174 | <constructor-arg ref="kustvakt_db" /> |
| 175 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 176 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 177 | <bean id="kustvakt_policies" class="de.ids_mannheim.korap.security.ac.PolicyDao"> |
| 178 | <constructor-arg ref="kustvakt_db" /> |
| 179 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 180 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 181 | <bean name="kustvakt_encryption" |
| 182 | class="de.ids_mannheim.korap.interfaces.defaults.KustvaktEncryption"> |
| 183 | <constructor-arg ref="kustvakt_config" /> |
| 184 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 185 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 186 | <!-- authentication providers to use --> |
| 187 | <bean id="api_auth" class="de.ids_mannheim.korap.security.auth.APIAuthentication"> |
| 188 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 189 | ref="kustvakt_config" /> |
| 190 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 191 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 192 | <bean id="openid_auth" |
| 193 | class="de.ids_mannheim.korap.security.auth.OpenIDconnectAuthentication"> |
| 194 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 195 | ref="kustvakt_config" /> |
| 196 | <constructor-arg |
| 197 | type="de.ids_mannheim.korap.interfaces.db.PersistenceClient" ref="kustvakt_db" /> |
| 198 | </bean> |
| 199 | |
| 200 | <bean id="basic_auth" class="de.ids_mannheim.korap.security.auth.BasicHttpAuth" /> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 201 | |
| 202 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 203 | <bean id="session_auth" |
| 204 | class="de.ids_mannheim.korap.security.auth.SessionAuthentication"> |
| 205 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 206 | ref="kustvakt_config" /> |
| 207 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 208 | ref="kustvakt_encryption" /> |
| 209 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 210 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 211 | <util:list id="kustvakt_authproviders" |
| 212 | value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface"> |
| 213 | <ref bean="basic_auth" /> |
| 214 | <ref bean="session_auth" /> |
| 215 | <ref bean="api_auth" /> |
| 216 | <ref bean="openid_auth" /> |
| 217 | </util:list> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 218 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 219 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 220 | <bean id="userdata_details" class="de.ids_mannheim.korap.handlers.UserDetailsDao"> |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 221 | <constructor-arg ref="kustvakt_db" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 222 | </bean> |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 223 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 224 | <bean id="userdata_settings" class="de.ids_mannheim.korap.handlers.UserSettingsDao"> |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 225 | <constructor-arg ref="kustvakt_db" /> |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 226 | </bean> |
Michael Hanl | daf8660 | 2016-05-12 14:31:52 +0200 | [diff] [blame] | 227 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 228 | <util:list id="kustvakt_userdata" |
| 229 | value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface"> |
| 230 | <ref bean="userdata_details" /> |
| 231 | <ref bean="userdata_settings" /> |
| 232 | </util:list> |
Michael Hanl | daf8660 | 2016-05-12 14:31:52 +0200 | [diff] [blame] | 233 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 234 | <util:list id="kustvakt_resources" |
| 235 | value-type="de.ids_mannheim.korap.interfaces.db.ResourceOperationIface"> |
| 236 | <ref bean="document_provider" /> |
| 237 | <ref bean="resource_provider" /> |
| 238 | </util:list> |
Michael Hanl | f8fcc7a | 2016-06-03 17:41:07 +0200 | [diff] [blame] | 239 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 240 | <!-- specify type for constructor argument --> |
| 241 | <bean id="kustvakt_authenticationmanager" |
| 242 | class="de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager"> |
| 243 | <constructor-arg |
| 244 | type="de.ids_mannheim.korap.interfaces.db.EntityHandlerIface" ref="kustvakt_userdb" /> |
| 245 | <constructor-arg |
| 246 | type="de.ids_mannheim.korap.interfaces.db.AdminHandlerIface" ref="kustvakt_admindb" /> |
| 247 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 248 | ref="kustvakt_encryption" /> |
| 249 | <constructor-arg ref="kustvakt_config" /> |
| 250 | <constructor-arg type="de.ids_mannheim.korap.interfaces.db.AuditingIface" |
| 251 | ref="kustvakt_auditing" /> |
| 252 | <constructor-arg ref="kustvakt_userdata" /> |
| 253 | <!-- inject authentication providers to use --> |
| 254 | <property name="providers" ref="kustvakt_authproviders" /> |
| 255 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 256 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 257 | <!-- todo: if db interfaces not loaded via spring, does transaction even |
| 258 | work then? --> |
| 259 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> |
| 260 | bean below) --> |
| 261 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
| 262 | <!-- the transactional semantics... --> |
| 263 | <tx:attributes> |
| 264 | <!-- all methods starting with 'get' are read-only --> |
| 265 | <tx:method name="get*" read-only="true" rollback-for="KorAPException" /> |
| 266 | <!-- other methods use the default transaction settings (see below) --> |
| 267 | <tx:method name="*" rollback-for="KorAPException" /> |
| 268 | </tx:attributes> |
| 269 | </tx:advice> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 270 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 271 | <!-- ensure that the above transactional advice runs for any execution of |
| 272 | an operation defined by the service interface --> |
| 273 | <aop:config> |
| 274 | <aop:pointcut id="service" |
| 275 | expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))" /> |
| 276 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service" /> |
| 277 | </aop:config> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 278 | |
margaretha | 62055f7 | 2017-04-11 19:17:43 +0200 | [diff] [blame] | 279 | <!-- similarly, don't forget the PlatformTransactionManager --> |
| 280 | <bean id="txManager" |
| 281 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| 282 | <property name="dataSource" ref="dataSource" /> |
| 283 | </bean> |
Michael Hanl | bd852b8 | 2015-11-18 22:17:00 +0100 | [diff] [blame] | 284 | </beans> |