margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 3 | xmlns:p="http://www.springframework.org/schema/p" |
| 4 | xmlns:util="http://www.springframework.org/schema/util" |
| 5 | xmlns:aop="http://www.springframework.org/schema/aop" |
| 6 | xmlns:tx="http://www.springframework.org/schema/tx" |
| 7 | xmlns="http://www.springframework.org/schema/beans" |
| 8 | xmlns:context="http://www.springframework.org/schema/context" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 9 | xmlns:cache="http://www.springframework.org/schema/cache" |
| 10 | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| 11 | http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
| 12 | http://www.springframework.org/schema/tx |
| 13 | http://www.springframework.org/schema/tx/spring-tx-4.0.xsd |
| 14 | http://www.springframework.org/schema/aop |
| 15 | http://www.springframework.org/schema/aop/spring-aop-4.0.xsd |
| 16 | http://www.springframework.org/schema/context |
| 17 | http://www.springframework.org/schema/context/spring-context-4.0.xsd |
| 18 | http://www.springframework.org/schema/util |
| 19 | http://www.springframework.org/schema/util/spring-util-4.0.xsd"> |
| 20 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 21 | <context:component-scan |
| 22 | base-package="de.ids_mannheim.korap" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 23 | <context:annotation-config /> |
| 24 | |
| 25 | <bean id="props" |
| 26 | class="org.springframework.beans.factory.config.PropertiesFactoryBean"> |
| 27 | <property name="ignoreResourceNotFound" value="true" /> |
| 28 | <property name="locations"> |
| 29 | <array> |
| 30 | <value>classpath:kustvakt.conf</value> |
| 31 | <value>file:./kustvakt.conf</value> |
| 32 | </array> |
| 33 | </property> |
| 34 | </bean> |
| 35 | |
| 36 | <bean id="placeholders" |
| 37 | class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"> |
| 38 | <property name="ignoreResourceNotFound" value="true" /> |
| 39 | <property name="locations"> |
| 40 | <array> |
| 41 | <value>classpath:properties/basic-jdbc.properties</value> |
| 42 | <value>file:./basic-jdbc.properties</value> |
| 43 | <value>classpath:properties/mail.properties</value> |
| 44 | <value>file:./mail.properties</value> |
margaretha | cc7feb6 | 2023-05-09 08:57:46 +0200 | [diff] [blame] | 45 | <value>classpath:properties/hibernate.properties</value> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 46 | |
| 47 | <value>classpath:kustvakt.conf</value> |
| 48 | <value>file:./kustvakt.conf</value> |
| 49 | </array> |
| 50 | </property> |
| 51 | </bean> |
| 52 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 53 | <bean id='cacheManager' |
| 54 | class='org.springframework.cache.ehcache.EhCacheCacheManager' |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 55 | p:cacheManager-ref='ehcache' /> |
| 56 | |
| 57 | <bean id='ehcache' |
| 58 | class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean' |
| 59 | p:configLocation='classpath:ehcache.xml' p:shared='true' /> |
| 60 | |
| 61 | <!--class="org.apache.commons.dbcp2.BasicDataSource" --> |
| 62 | <!-- org.springframework.jdbc.datasource.SingleConnectionDataSource --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 63 | <bean id="dataSource" |
| 64 | class="org.apache.commons.dbcp2.BasicDataSource" lazy-init="true"> |
| 65 | <property name="driverClassName" |
| 66 | value="${jdbc.driverClassName}" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 67 | <property name="url" value="${jdbc.url}" /> |
| 68 | <property name="username" value="${jdbc.username}" /> |
| 69 | <property name="password" value="${jdbc.password}" /> |
| 70 | <!-- relevant for single connection datasource and sqlite --> |
| 71 | <!-- <property name="suppressClose"> <value>true</value> </property> --> |
| 72 | <!--<property name="initialSize" value="2"/> --> |
| 73 | <property name="maxTotal" value="4" /> |
| 74 | <property name="maxIdle" value="2" /> |
| 75 | <property name="minIdle" value="1" /> |
| 76 | <property name="maxWaitMillis" value="15000" /> |
| 77 | <!--<property name="poolPreparedStatements" value="true"/> --> |
| 78 | </bean> |
| 79 | |
| 80 | <bean id="sqliteDataSource" |
| 81 | class="org.springframework.jdbc.datasource.SingleConnectionDataSource" |
| 82 | lazy-init="true"> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 83 | <property name="driverClassName" |
| 84 | value="${jdbc.driverClassName}" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 85 | <property name="url" value="${jdbc.url}" /> |
| 86 | <property name="username" value="${jdbc.username}" /> |
| 87 | <property name="password" value="${jdbc.password}" /> |
| 88 | <property name="connectionProperties"> |
| 89 | <props> |
| 90 | <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop> |
| 91 | </props> |
| 92 | </property> |
| 93 | |
| 94 | <!-- relevant for single connection datasource and sqlite --> |
| 95 | <property name="suppressClose"> |
| 96 | <value>true</value> |
| 97 | </property> |
| 98 | <!--<property name="initialSize" value="2"/> --> |
| 99 | <!--<property name="poolPreparedStatements" value="true"/> --> |
| 100 | </bean> |
| 101 | |
| 102 | <!-- to configure database for sqlite, mysql, etc. migrations --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 103 | <bean id="flywayConfig" |
| 104 | class="org.flywaydb.core.api.configuration.ClassicConfiguration"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 105 | <property name="baselineOnMigrate" value="true" /> |
| 106 | <!-- <property name="validateOnMigrate" value="false" /> --> |
| 107 | <!-- <property name="cleanOnValidationError" value="true" /> --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 108 | <property name="locations" |
| 109 | value="#{'${jdbc.schemaPath}'.split(',')}" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 110 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 111 | <property name="dataSource" ref="sqliteDataSource" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 112 | <property name="outOfOrder" value="true" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 113 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 114 | |
| 115 | <bean id="flyway" class="org.flywaydb.core.Flyway" |
| 116 | init-method="migrate"> |
| 117 | <constructor-arg ref="flywayConfig" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 118 | </bean> |
| 119 | |
| 120 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 121 | <bean id="kustvakt_db" |
| 122 | class="de.ids_mannheim.korap.handlers.JDBCClient"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 123 | <constructor-arg index="0" ref="dataSource" /> |
| 124 | <!-- deprecated property --> |
| 125 | <property name="database" value="${jdbc.database}" /> |
| 126 | </bean> |
| 127 | |
| 128 | <bean id="entityManagerFactory" |
| 129 | class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" |
| 130 | depends-on="flyway"> |
| 131 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 132 | <property name="dataSource" ref="sqliteDataSource" /> |
| 133 | |
| 134 | <property name="packagesToScan"> |
| 135 | <array> |
| 136 | <value>de.ids_mannheim.korap.entity</value> |
| 137 | <value>de.ids_mannheim.korap.oauth2.entity</value> |
| 138 | </array> |
| 139 | </property> |
| 140 | <property name="jpaVendorAdapter"> |
| 141 | <bean id="jpaVendorAdapter" |
| 142 | class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 143 | <property name="databasePlatform" |
| 144 | value="${hibernate.dialect}" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 145 | </bean> |
| 146 | </property> |
| 147 | <property name="jpaProperties"> |
| 148 | <props> |
| 149 | <prop key="hibernate.dialect">${hibernate.dialect}</prop> |
| 150 | <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> |
| 151 | <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> |
| 152 | <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> |
| 153 | <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache} |
| 154 | </prop> |
| 155 | <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop> |
| 156 | <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop> |
| 157 | <prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop> |
| 158 | <!-- <prop key="net.sf.ehcache.configurationResourceName">classpath:ehcache.xml</prop> --> |
| 159 | </props> |
| 160 | </property> |
| 161 | </bean> |
| 162 | |
| 163 | <tx:annotation-driven proxy-target-class="true" |
| 164 | transaction-manager="transactionManager" /> |
| 165 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 166 | <bean id="transactionManager" |
| 167 | class="org.springframework.orm.jpa.JpaTransactionManager"> |
| 168 | <property name="entityManagerFactory" |
| 169 | ref="entityManagerFactory" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 170 | </bean> |
| 171 | |
| 172 | <bean id="transactionTemplate" |
| 173 | class="org.springframework.transaction.support.TransactionTemplate"> |
| 174 | <constructor-arg ref="transactionManager" /> |
| 175 | </bean> |
| 176 | |
| 177 | <!-- Data access objects --> |
| 178 | <bean id="adminDao" class="de.ids_mannheim.korap.dao.AdminDaoImpl" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 179 | <bean id="authorizationDao" |
| 180 | class="de.ids_mannheim.korap.oauth2.dao.CachedAuthorizationDaoImpl" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 181 | |
| 182 | <!-- Services --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 183 | <bean id="scopeService" |
| 184 | class="de.ids_mannheim.korap.oauth2.service.OAuth2ScopeServiceImpl" /> |
| 185 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 186 | <!-- props are injected from default-config.xml --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 187 | <bean id="kustvakt_config" |
| 188 | class="de.ids_mannheim.korap.config.FullConfiguration"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 189 | <constructor-arg name="properties" ref="props" /> |
| 190 | </bean> |
| 191 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 192 | <bean id="initializator" |
| 193 | class="de.ids_mannheim.de.init.Initializator" init-method="init"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 194 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 195 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 196 | <!-- Krill --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 197 | <bean id="search_krill" |
| 198 | class="de.ids_mannheim.korap.web.SearchKrill"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 199 | <constructor-arg value="${krill.indexDir}" /> |
| 200 | </bean> |
| 201 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 202 | <!-- Validator --> |
| 203 | <bean id="validator" |
| 204 | class="de.ids_mannheim.korap.validator.ApacheValidator" /> |
| 205 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 206 | <!-- URLValidator --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 207 | <bean id="redirectURIValidator" |
| 208 | class="org.apache.commons.validator.routines.UrlValidator"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 209 | <constructor-arg value="http,https" index="0" /> |
| 210 | <constructor-arg index="1" type="long"> |
| 211 | <util:constant |
| 212 | static-field="org.apache.commons.validator.routines.UrlValidator.NO_FRAGMENTS" /> |
| 213 | </constructor-arg> |
| 214 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 215 | <bean id="urlValidator" |
| 216 | class="org.apache.commons.validator.routines.UrlValidator"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 217 | <constructor-arg value="http,https" /> |
| 218 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 219 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 220 | <!-- Rewrite --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 221 | <bean id="foundryRewrite" |
| 222 | class="de.ids_mannheim.korap.rewrite.FoundryRewrite" /> |
| 223 | <bean id="collectionRewrite" |
| 224 | class="de.ids_mannheim.korap.rewrite.CollectionRewrite" /> |
| 225 | <bean id="virtualCorpusRewrite" |
| 226 | class="de.ids_mannheim.korap.rewrite.VirtualCorpusRewrite" /> |
| 227 | <bean id="queryReferenceRewrite" |
| 228 | class="de.ids_mannheim.korap.rewrite.QueryReferenceRewrite" /> |
| 229 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 230 | <util:list id="rewriteTasks" |
| 231 | value-type="de.ids_mannheim.korap.rewrite.RewriteTask"> |
| 232 | <ref bean="foundryRewrite" /> |
| 233 | <ref bean="collectionRewrite" /> |
| 234 | <ref bean="virtualCorpusRewrite" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 235 | <ref bean="queryReferenceRewrite" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 236 | </util:list> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 237 | |
| 238 | <bean id="rewriteHandler" |
| 239 | class="de.ids_mannheim.korap.rewrite.RewriteHandler"> |
| 240 | <constructor-arg ref="rewriteTasks" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 241 | </bean> |
| 242 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 243 | <bean id="kustvaktResponseHandler" |
| 244 | class="de.ids_mannheim.korap.web.KustvaktResponseHandler"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 245 | </bean> |
| 246 | |
| 247 | <!-- OAuth --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 248 | <bean id="oauth2ResponseHandler" |
| 249 | class="de.ids_mannheim.korap.web.OAuth2ResponseHandler"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 250 | </bean> |
| 251 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 252 | <bean id="kustvakt_userdb" |
| 253 | class="de.ids_mannheim.korap.handlers.EntityDao"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 254 | <constructor-arg ref="kustvakt_db" /> |
| 255 | </bean> |
| 256 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 257 | <bean name="kustvakt_encryption" |
| 258 | class="de.ids_mannheim.korap.encryption.KustvaktEncryption"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 259 | <constructor-arg ref="kustvakt_config" /> |
| 260 | </bean> |
| 261 | |
| 262 | <!-- authentication providers to use --> |
| 263 | <!-- <bean id="api_auth" class="de.ids_mannheim.korap.authentication.APIAuthentication"> |
| 264 | <constructor-arg type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
| 265 | ref="kustvakt_config" /> </bean> --> |
| 266 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 267 | <bean id="ldap_auth" |
| 268 | class="de.ids_mannheim.korap.authentication.LdapAuth3"> |
| 269 | <constructor-arg |
| 270 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 271 | ref="kustvakt_config" /> |
| 272 | </bean> |
| 273 | |
| 274 | <bean id="basic_auth" |
| 275 | class="de.ids_mannheim.korap.authentication.BasicAuthentication" /> |
| 276 | |
| 277 | |
| 278 | <bean id="session_auth" |
| 279 | class="de.ids_mannheim.korap.authentication.SessionAuthentication"> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 280 | <constructor-arg |
| 281 | type="de.ids_mannheim.korap.config.KustvaktConfiguration" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 282 | ref="kustvakt_config" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 283 | <constructor-arg |
| 284 | type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 285 | ref="kustvakt_encryption" /> |
| 286 | </bean> |
| 287 | |
| 288 | <bean id="oauth2_auth" |
| 289 | class="de.ids_mannheim.korap.authentication.OAuth2Authentication" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 290 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 291 | <util:list id="kustvakt_authproviders" |
| 292 | value-type="de.ids_mannheim.korap.interfaces.AuthenticationIface"> |
| 293 | <ref bean="basic_auth" /> |
| 294 | <ref bean="ldap_auth" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 295 | <!-- <ref bean="session_auth" /> <ref bean="api_auth" /> --> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 296 | <ref bean="oauth2_auth" /> |
| 297 | </util:list> |
| 298 | |
| 299 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 300 | <bean id="userdata_details" |
| 301 | class="de.ids_mannheim.korap.handlers.UserDetailsDao"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 302 | <constructor-arg ref="kustvakt_db" /> |
| 303 | </bean> |
| 304 | |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 305 | <bean id="userdata_settings" |
| 306 | class="de.ids_mannheim.korap.handlers.UserSettingsDao"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 307 | <constructor-arg ref="kustvakt_db" /> |
| 308 | </bean> |
| 309 | |
| 310 | <util:list id="kustvakt_userdata" |
| 311 | value-type="de.ids_mannheim.korap.interfaces.db.UserdataDbIface"> |
| 312 | <ref bean="userdata_details" /> |
| 313 | <ref bean="userdata_settings" /> |
| 314 | </util:list> |
| 315 | |
| 316 | <!-- specify type for constructor argument --> |
| 317 | <bean id="authenticationManager" |
| 318 | class="de.ids_mannheim.korap.authentication.KustvaktAuthenticationManager"> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 319 | <constructor-arg |
| 320 | type="de.ids_mannheim.korap.interfaces.EntityHandlerIface" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 321 | ref="kustvakt_userdb" /> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 322 | <constructor-arg |
| 323 | type="de.ids_mannheim.korap.interfaces.EncryptionIface" |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 324 | ref="kustvakt_encryption" /> |
| 325 | <constructor-arg ref="kustvakt_config" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 326 | <constructor-arg ref="kustvakt_userdata" /> |
| 327 | <!-- inject authentication providers to use --> |
| 328 | <property name="providers" ref="kustvakt_authproviders" /> |
| 329 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 330 | |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 331 | <!-- todo: if db interfaces not loaded via spring, does transaction even |
| 332 | work then? --> |
| 333 | <!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> |
| 334 | bean below) --> |
| 335 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
| 336 | <!-- the transactional semantics... --> |
| 337 | <tx:attributes> |
| 338 | <!-- all methods starting with 'get' are read-only --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 339 | <tx:method name="get*" read-only="true" |
| 340 | rollback-for="KorAPException" /> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 341 | <!-- other methods use the default transaction settings (see below) --> |
| 342 | <tx:method name="*" rollback-for="KorAPException" /> |
| 343 | </tx:attributes> |
| 344 | </tx:advice> |
| 345 | |
| 346 | <!-- ensure that the above transactional advice runs for any execution of |
| 347 | an operation defined by the service interface --> |
| 348 | <aop:config> |
| 349 | <aop:pointcut id="service" |
| 350 | expression="execution(* de.ids_mannheim.korap.interfaces.db.*.*(..))" /> |
| 351 | <aop:advisor advice-ref="txAdvice" pointcut-ref="service" /> |
| 352 | </aop:config> |
| 353 | |
| 354 | <!-- similarly, don't forget the PlatformTransactionManager --> |
| 355 | <bean id="txManager" |
| 356 | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| 357 | <!-- <property name="dataSource" ref="dataSource" /> --> |
| 358 | <property name="dataSource" ref="sqliteDataSource" /> |
| 359 | </bean> |
| 360 | |
| 361 | <!-- mail --> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 362 | <bean id="authenticator" |
| 363 | class="de.ids_mannheim.korap.service.MailAuthenticator"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 364 | <constructor-arg index="0" value="${mail.username}" /> |
| 365 | <constructor-arg index="1" value="${mail.password}" /> |
| 366 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 367 | <bean id="smtpSession" class="jakarta.mail.Session" |
| 368 | factory-method="getInstance"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 369 | <constructor-arg index="0"> |
| 370 | <props> |
| 371 | <prop key="mail.smtp.submitter">${mail.username}</prop> |
| 372 | <prop key="mail.smtp.auth">${mail.auth}</prop> |
| 373 | <prop key="mail.smtp.host">${mail.host}</prop> |
| 374 | <prop key="mail.smtp.port">${mail.port}</prop> |
| 375 | <prop key="mail.smtp.starttls.enable">${mail.starttls.enable}</prop> |
| 376 | <prop key="mail.smtp.connectiontimeout">${mail.connectiontimeout}</prop> |
| 377 | </props> |
| 378 | </constructor-arg> |
| 379 | <constructor-arg index="1" ref="authenticator" /> |
| 380 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 381 | <bean id="mailSender" |
| 382 | class="org.springframework.mail.javamail.JavaMailSenderImpl"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 383 | <property name="username" value="${mail.username}" /> |
| 384 | <property name="password" value="${mail.password}" /> |
| 385 | <property name="session" ref="smtpSession" /> |
| 386 | </bean> |
margaretha | 35e1ca2 | 2023-11-16 22:00:01 +0100 | [diff] [blame] | 387 | <bean id="velocityEngine" |
| 388 | class="org.apache.velocity.app.VelocityEngine"> |
margaretha | ceae697 | 2022-05-31 10:57:11 +0200 | [diff] [blame] | 389 | <constructor-arg index="0"> |
| 390 | <props> |
| 391 | <prop key="resource.loader">class</prop> |
| 392 | <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader |
| 393 | </prop> |
| 394 | </props> |
| 395 | </constructor-arg> |
| 396 | </bean> |
| 397 | </beans> |