Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +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" |
| 5 | xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 6 | xmlns:cache="http://www.springframework.org/schema/cache" |
| 7 | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| 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"> |
| 17 | |
| 18 | <context:component-scan base-package="de.ids_mannheim.korap" /> |
| 19 | <context:annotation-config /> |
| 20 | |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 21 | <!-- <bean id="test" class="de.ids_mannheim.korap.web.Test"> <property name="config" |
| 22 | ref="kustvakt_config" /> </bean> --> |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 23 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 24 | <bean id="props" |
| 25 | class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
| 26 | <property name="ignoreResourceNotFound" value="true" /> |
| 27 | <property name="locations"> |
| 28 | <array> |
| 29 | <value>classpath:kustvakt.conf</value> |
| 30 | <value>file:./kustvakt.conf</value> |
| 31 | </array> |
| 32 | </property> |
| 33 | </bean> |
| 34 | |
| 35 | <bean id="placeholders" |
| 36 | class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> |
| 37 | <property name="ignoreResourceNotFound" value="true" /> |
| 38 | <property name="locations"> |
| 39 | <array> |
margaretha | aecee1b | 2018-02-20 14:44:21 +0100 | [diff] [blame] | 40 | <value>classpath:properties/jdbc.properties</value> |
margaretha | ea68a0a | 2017-09-21 03:09:49 +0200 | [diff] [blame] | 41 | <value>file:./jdbc.properties</value> |
margaretha | aecee1b | 2018-02-20 14:44:21 +0100 | [diff] [blame] | 42 | <value>classpath:properties/mail.properties</value> |
| 43 | <value>file:./mail.properties</value> |
| 44 | <value>classpath:properties/hibernate.properties</value> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 45 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 46 | <value>classpath:kustvakt.conf</value> |
margaretha | 14503cd | 2017-09-08 15:35:24 +0200 | [diff] [blame] | 47 | <value>file:./kustvakt.conf</value> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 48 | </array> |
| 49 | </property> |
| 50 | </bean> |
| 51 | |
| 52 | <bean id='cacheManager' class='org.springframework.cache.ehcache.EhCacheCacheManager' |
| 53 | p:cacheManager-ref='ehcache' /> |
| 54 | |
| 55 | <bean id='ehcache' |
| 56 | class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean' |
| 57 | p:configLocation='classpath:ehcache.xml' p:shared='true' /> |
| 58 | |
| 59 | <!-- props are injected from default-config.xml --> |
margaretha | 56e8e55 | 2017-12-05 16:31:21 +0100 | [diff] [blame] | 60 | <bean id="kustvakt_config" class="de.ids_mannheim.korap.config.FullConfiguration"> |
margaretha | f68daa6 | 2017-09-21 02:11:24 +0200 | [diff] [blame] | 61 | <constructor-arg name="properties" ref="props" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 62 | </bean> |
| 63 | |
| 64 | <!--class="org.apache.commons.dbcp2.BasicDataSource" --> |
| 65 | <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource --> |
| 66 | <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" |
| 67 | lazy-init="true"> |
| 68 | <property name="driverClassName" value="${jdbc.driverClassName}" /> |
| 69 | <property name="url" value="${jdbc.url}" /> |
| 70 | <property name="username" value="${jdbc.username}" /> |
| 71 | <property name="password" value="${jdbc.password}" /> |
| 72 | <!-- relevant for single connection datasource and sqlite --> |
| 73 | <!-- <property name="suppressClose"> <value>true</value> </property> --> |
| 74 | <!--<property name="initialSize" value="2"/> --> |
| 75 | <property name="maxTotal" value="4" /> |
| 76 | <property name="maxIdle" value="2" /> |
| 77 | <property name="minIdle" value="1" /> |
| 78 | <property name="maxWaitMillis" value="15000" /> |
| 79 | <!--<property name="poolPreparedStatements" value="true"/> --> |
| 80 | </bean> |
| 81 | |
| 82 | <bean id="sqliteDataSource" |
| 83 | class="org.springframework.jdbc.datasource.SingleConnectionDataSource" |
| 84 | lazy-init="true"> |
| 85 | <property name="driverClassName" value="${jdbc.driverClassName}" /> |
| 86 | <property name="url" value="${jdbc.url}" /> |
| 87 | <property name="username" value="${jdbc.username}" /> |
| 88 | <property name="password" value="${jdbc.password}" /> |
margaretha | e6c711b | 2018-02-06 21:55:04 +0100 | [diff] [blame] | 89 | <property name="connectionProperties"> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 90 | <props> |
| 91 | <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop> |
| 92 | </props> |
| 93 | </property> |
| 94 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 95 | <!-- relevant for single connection datasource and sqlite --> |
| 96 | <property name="suppressClose"> |
| 97 | <value>true</value> |
| 98 | </property> |
| 99 | <!--<property name="initialSize" value="2"/> --> |
| 100 | <!--<property name="poolPreparedStatements" value="true"/> --> |
| 101 | </bean> |
| 102 | |
| 103 | <!-- to configure database for sqlite, mysql, etc. migrations --> |
| 104 | <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate"> |
margaretha | f6d5a82 | 2017-10-19 19:51:20 +0200 | [diff] [blame] | 105 | <property name="baselineOnMigrate" value="true" /> |
margaretha | ecbe72d | 2017-07-26 17:13:32 +0200 | [diff] [blame] | 106 | <!-- <property name="validateOnMigrate" value="false" /> --> |
| 107 | <!-- <property name="cleanOnValidationError" value="true" /> --> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 108 | <property name="locations" value="${jdbc.schemaPath}" /> |
margaretha | 894a7d7 | 2017-11-08 19:24:20 +0100 | [diff] [blame] | 109 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 110 | <property name="dataSource" ref="sqliteDataSource" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 111 | </bean> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 112 | |
| 113 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 114 | <bean id="kustvakt_db" class="de.ids_mannheim.korap.handlers.JDBCClient"> |
| 115 | <constructor-arg index="0" ref="dataSource" /> |
| 116 | <!-- deprecated property --> |
| 117 | <property name="database" value="${jdbc.database}" /> |
| 118 | </bean> |
| 119 | |
| 120 | <bean id="entityManagerFactory" |
| 121 | class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> |
margaretha | 894a7d7 | 2017-11-08 19:24:20 +0100 | [diff] [blame] | 122 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 123 | <property name="dataSource" ref="sqliteDataSource" /> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 124 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 125 | <property name="packagesToScan" value="de.ids_mannheim.korap.entity" /> |
| 126 | <property name="jpaVendorAdapter"> |
| 127 | <bean id="jpaVendorAdapter" |
| 128 | class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> |
| 129 | <property name="databasePlatform" value="${hibernate.dialect}" /> |
| 130 | </bean> |
| 131 | </property> |
| 132 | <property name="jpaProperties"> |
| 133 | <props> |
| 134 | <prop key="hibernate.dialect">${hibernate.dialect}</prop> |
| 135 | <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> |
| 136 | <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> |
| 137 | <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> |
| 138 | <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache} |
| 139 | </prop> |
| 140 | <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop> |
| 141 | <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop> |
| 142 | <!-- <prop key="net.sf.ehcache.configurationResourceName">classpath:ehcache.xml</prop> --> |
| 143 | </props> |
| 144 | </property> |
| 145 | </bean> |
| 146 | |
| 147 | <tx:annotation-driven proxy-target-class="true" |
| 148 | transaction-manager="transactionManager" /> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 149 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 150 | <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> |
| 151 | <property name="entityManagerFactory" ref="entityManagerFactory" /> |
| 152 | </bean> |
| 153 | |
| 154 | <bean id="transactionTemplate" |
| 155 | class="org.springframework.transaction.support.TransactionTemplate"> |
| 156 | <constructor-arg ref="transactionManager" /> |
| 157 | </bean> |
| 158 | |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 159 | <!-- Data access objects --> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 160 | <bean id="resourceDao" class="de.ids_mannheim.korap.dao.ResourceDao" /> |
margaretha | ade7d4a | 2017-07-20 19:53:35 +0200 | [diff] [blame] | 161 | <!-- <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao"/> --> |
| 162 | |
| 163 | <!-- Krill --> |
| 164 | <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill"> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 165 | <constructor-arg value="${krill.indexDir}" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 166 | </bean> |
| 167 | |
margaretha | 31a9f52 | 2018-04-03 20:40:45 +0200 | [diff] [blame] | 168 | <!-- URLValidator --> |
| 169 | <bean id="urlValidator" class="org.apache.commons.validator.routines.UrlValidator"> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 170 | <constructor-arg value="http,https" /> |
margaretha | 31a9f52 | 2018-04-03 20:40:45 +0200 | [diff] [blame] | 171 | </bean> |
margaretha | a048627 | 2018-04-12 19:59:31 +0200 | [diff] [blame] | 172 | <bean id="httpsValidator" class="org.apache.commons.validator.routines.UrlValidator"> |
| 173 | <constructor-arg value="https"/> |
| 174 | </bean> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 175 | |
margaretha | 56e8e55 | 2017-12-05 16:31:21 +0100 | [diff] [blame] | 176 | <bean id="kustvakt_rewrite" class="de.ids_mannheim.korap.rewrite.FullRewriteHandler"> |
| 177 | <constructor-arg ref="kustvakt_config" /> |
| 178 | </bean> |
| 179 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 180 | <bean id="kustvakt_auditing" class="de.ids_mannheim.korap.handlers.JDBCAuditing"> |
| 181 | <constructor-arg ref="kustvakt_db" /> |
| 182 | </bean> |
| 183 | |
margaretha | 0512231 | 2018-04-16 15:01:34 +0200 | [diff] [blame] | 184 | <bean id="kustvaktResponseHandler" class="de.ids_mannheim.korap.web.KustvaktExceptionHandler"> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 185 | <constructor-arg index="0" name="iface" ref="kustvakt_auditing" /> |
| 186 | </bean> |
margaretha | fb027f9 | 2018-04-23 20:00:13 +0200 | [diff] [blame^] | 187 | |
| 188 | <!-- OAuth --> |
| 189 | <bean id="oauth2ResponseHandler" class="de.ids_mannheim.korap.web.OAuth2ResponseHandler"> |
margaretha | 0512231 | 2018-04-16 15:01:34 +0200 | [diff] [blame] | 190 | <constructor-arg index="0" name="iface" ref="kustvakt_auditing" /> |
| 191 | </bean> |
margaretha | fb027f9 | 2018-04-23 20:00:13 +0200 | [diff] [blame^] | 192 | |
| 193 | <bean id="mdGenerator" class="org.apache.oltu.oauth2.as.issuer.MD5Generator"> |
| 194 | </bean> |
| 195 | <bean id="oauthIssuer" class="org.apache.oltu.oauth2.as.issuer.OAuthIssuerImpl"> |
| 196 | <constructor-arg index="0" ref="mdGenerator" /> |
| 197 | </bean> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 198 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 199 | <bean id="kustvakt_userdb" class="de.ids_mannheim.korap.handlers.EntityDao"> |
| 200 | <constructor-arg ref="kustvakt_db" /> |
| 201 | </bean> |
| 202 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 203 | <bean id="resource_provider" class="de.ids_mannheim.korap.handlers.ResourceDao"> |
| 204 | <constructor-arg ref="kustvakt_db" /> |
| 205 | </bean> |
| 206 | |
| 207 | <bean id="document_provider" class="de.ids_mannheim.korap.handlers.DocumentDao"> |
| 208 | <constructor-arg ref="kustvakt_db" /> |
| 209 | </bean> |
| 210 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 211 | <bean name="kustvakt_encryption" |
margaretha | 6d61a55 | 2018-04-10 19:26:44 +0200 | [diff] [blame] | 212 | class="de.ids_mannheim.korap.encryption.KustvaktEncryption"> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 213 | <constructor-arg ref="kustvakt_config" /> |
| 214 | </bean> |
| 215 | |
| 216 | <!-- authentication providers to use --> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 217 | <!-- <bean id="api_auth" class="de.ids_mannheim.korap.authentication.APIAuthentication"> |
| 218 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 219 | ref="kustvakt_config" /> </bean> --> |
| 220 | |
| 221 | <bean id="client_auth" |
| 222 | class="de.ids_mannheim.korap.authentication.OAuth2ClientAuthentication" /> |
| 223 | |
margaretha | 4de4119 | 2017-11-15 11:47:11 +0100 | [diff] [blame] | 224 | <bean id="ldap_auth" class="de.ids_mannheim.korap.authentication.LdapAuth3"> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 225 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 226 | ref="kustvakt_config" /> |
| 227 | </bean> |
| 228 | |
| 229 | <bean id="openid_auth" |
margaretha | 139d0f7 | 2017-11-14 18:56:22 +0100 | [diff] [blame] | 230 | class="de.ids_mannheim.korap.authentication.OpenIDconnectAuthentication"> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 231 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 232 | ref="kustvakt_config" /> |
| 233 | <constructor-arg |
| 234 | type="de.ids_mannheim.korap.interfaces.db.PersistenceClient" ref="kustvakt_db" /> |
| 235 | </bean> |
| 236 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 237 | <bean id="session_auth" |
margaretha | 139d0f7 | 2017-11-14 18:56:22 +0100 | [diff] [blame] | 238 | class="de.ids_mannheim.korap.authentication.SessionAuthentication"> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 239 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 240 | ref="kustvakt_config" /> |
| 241 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 242 | ref="kustvakt_encryption" /> |
| 243 | </bean> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 244 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 245 | <util:list id="kustvakt_authproviders" |
| 246 | value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface"> |
margaretha | 4de4119 | 2017-11-15 11:47:11 +0100 | [diff] [blame] | 247 | <ref bean="ldap_auth" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 248 | <ref bean="session_auth" /> |
margaretha | 4de4119 | 2017-11-15 11:47:11 +0100 | [diff] [blame] | 249 | <!-- <ref bean="api_auth" /> --> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 250 | <ref bean="openid_auth" /> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 251 | <ref bean="client_auth" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 252 | </util:list> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 253 | |
| 254 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 255 | <bean id="userdata_details" class="de.ids_mannheim.korap.handlers.UserDetailsDao"> |
| 256 | <constructor-arg ref="kustvakt_db" /> |
| 257 | </bean> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 258 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 259 | <bean id="userdata_settings" class="de.ids_mannheim.korap.handlers.UserSettingsDao"> |
| 260 | <constructor-arg ref="kustvakt_db" /> |
| 261 | </bean> |
| 262 | |
| 263 | <util:list id="kustvakt_userdata" |
| 264 | value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface"> |
| 265 | <ref bean="userdata_details" /> |
| 266 | <ref bean="userdata_settings" /> |
| 267 | </util:list> |
Michael Hanl | 72c7b83 | 2015-09-03 08:42:15 +0200 | [diff] [blame] | 268 | |
Michael Hanl | daf8660 | 2016-05-12 14:31:52 +0200 | [diff] [blame] | 269 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 270 | <util:list id="kustvakt_resources" |
| 271 | value-type="de.ids_mannheim.korap.interfaces.db.ResourceOperationIface"> |
| 272 | <ref bean="document_provider" /> |
| 273 | <ref bean="resource_provider" /> |
| 274 | </util:list> |
Michael Hanl | f8fcc7a | 2016-06-03 17:41:07 +0200 | [diff] [blame] | 275 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 276 | <!-- specify type for constructor argument --> |
| 277 | <bean id="kustvakt_authenticationmanager" |
margaretha | 139d0f7 | 2017-11-14 18:56:22 +0100 | [diff] [blame] | 278 | class="de.ids_mannheim.korap.authentication.KustvaktAuthenticationManager"> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 279 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EntityHandlerIface" |
| 280 | ref="kustvakt_userdb" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 281 | <constructor-arg type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
| 282 | ref="kustvakt_encryption" /> |
| 283 | <constructor-arg ref="kustvakt_config" /> |
| 284 | <constructor-arg type="de.ids_mannheim.korap.interfaces.db.AuditingIface" |
| 285 | ref="kustvakt_auditing" /> |
| 286 | <constructor-arg ref="kustvakt_userdata" /> |
| 287 | <!-- inject authentication providers to use --> |
| 288 | <property name="providers" ref="kustvakt_authproviders" /> |
| 289 | </bean> |
Michael Hanl | daf8660 | 2016-05-12 14:31:52 +0200 | [diff] [blame] | 290 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 291 | <!-- todo: if db interfaces not loaded via spring, does transaction even |
| 292 | work then? --> |
| 293 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> |
| 294 | bean below) --> |
| 295 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
| 296 | <!-- the transactional semantics... --> |
| 297 | <tx:attributes> |
| 298 | <!-- all methods starting with 'get' are read-only --> |
| 299 | <tx:method name="get*" read-only="true" rollback-for="KorAPException" /> |
| 300 | <!-- other methods use the default transaction settings (see below) --> |
| 301 | <tx:method name="*" rollback-for="KorAPException" /> |
| 302 | </tx:attributes> |
| 303 | </tx:advice> |
Michael Hanl | daf8660 | 2016-05-12 14:31:52 +0200 | [diff] [blame] | 304 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 305 | <!-- ensure that the above transactional advice runs for any execution of |
| 306 | an operation defined by the service interface --> |
| 307 | <aop:config> |
| 308 | <aop:pointcut id="service" |
| 309 | expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))" /> |
| 310 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service" /> |
| 311 | </aop:config> |
Michael Hanl | f8fcc7a | 2016-06-03 17:41:07 +0200 | [diff] [blame] | 312 | |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 313 | <!-- similarly, don't forget the PlatformTransactionManager --> |
| 314 | <bean id="txManager" |
| 315 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
margaretha | 894a7d7 | 2017-11-08 19:24:20 +0100 | [diff] [blame] | 316 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 317 | <property name="dataSource" ref="sqliteDataSource" /> |
margaretha | 543f200 | 2017-07-14 00:27:15 +0200 | [diff] [blame] | 318 | </bean> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 319 | |
margaretha | c9f1dfa | 2018-02-07 17:50:33 +0100 | [diff] [blame] | 320 | <!-- mail --> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 321 | <bean id="authenticator" class="de.ids_mannheim.korap.service.MailAuthenticator"> |
| 322 | <constructor-arg index="0" value="${mail.username}" /> |
| 323 | <constructor-arg index="1" value="${mail.password}" /> |
margaretha | aecee1b | 2018-02-20 14:44:21 +0100 | [diff] [blame] | 324 | </bean> |
| 325 | <bean id="smtpSession" class="javax.mail.Session" factory-method="getInstance"> |
| 326 | <constructor-arg index="0"> |
| 327 | <props> |
| 328 | <prop key="mail.smtp.submitter">${mail.username}</prop> |
| 329 | <prop key="mail.smtp.auth">${mail.auth}</prop> |
| 330 | <prop key="mail.smtp.host">${mail.host}</prop> |
| 331 | <prop key="mail.smtp.port">${mail.port}</prop> |
| 332 | <prop key="mail.smtp.starttls.enable">${mail.starttls.enable}</prop> |
| 333 | <prop key="mail.smtp.connectiontimeout">${mail.connectiontimeout}</prop> |
| 334 | </props> |
| 335 | </constructor-arg> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 336 | <constructor-arg index="1" ref="authenticator" /> |
margaretha | c9f1dfa | 2018-02-07 17:50:33 +0100 | [diff] [blame] | 337 | </bean> |
| 338 | <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> |
margaretha | aecee1b | 2018-02-20 14:44:21 +0100 | [diff] [blame] | 339 | <property name="username" value="${mail.username}" /> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 340 | <property name="password" value="${mail.password}" /> |
margaretha | c9f1dfa | 2018-02-07 17:50:33 +0100 | [diff] [blame] | 341 | <property name="session" ref="smtpSession" /> |
| 342 | </bean> |
| 343 | <bean id="velocityEngine" class="org.apache.velocity.app.VelocityEngine"> |
| 344 | <constructor-arg index="0"> |
| 345 | <props> |
| 346 | <prop key="resource.loader">class</prop> |
margaretha | 0e8f4e7 | 2018-04-05 14:11:52 +0200 | [diff] [blame] | 347 | <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader |
| 348 | </prop> |
margaretha | c9f1dfa | 2018-02-07 17:50:33 +0100 | [diff] [blame] | 349 | </props> |
| 350 | </constructor-arg> |
margaretha | aecee1b | 2018-02-20 14:44:21 +0100 | [diff] [blame] | 351 | </bean> |
Michael Hanl | ca740d7 | 2015-06-16 10:04:58 +0200 | [diff] [blame] | 352 | </beans> |