blob: 96ac3bf1956c8a6d2446bb687b5500d92c18f328 [file] [log] [blame]
margaretha2df06602018-11-14 19:10:30 +01001<?xml version="1.0" encoding="UTF-8"?>
2<beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
4 xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
5 xsi:schemaLocation="http://www.springframework.org/schema/beans
6 http://www.springframework.org/schema/beans/spring-beans.xsd
7 http://www.springframework.org/schema/tx
8 http://www.springframework.org/schema/tx/spring-tx.xsd
9 http://www.springframework.org/schema/context
10 http://www.springframework.org/schema/context/spring-context.xsd
11 http://www.springframework.org/schema/util
12 http://www.springframework.org/schema/util/spring-util.xsd">
margaretha92ad2ec2023-05-15 14:10:00 +020013
14 <context:component-scan base-package="
margaretha5b708792023-05-12 16:55:29 +020015 de.ids_mannheim.korap.core.service,
margarethaac92c822023-05-15 11:43:22 +020016 de.ids_mannheim.korap.core.web,
margaretha4fa4b062019-01-28 19:43:30 +010017 de.ids_mannheim.korap.web.filter,
18 de.ids_mannheim.korap.web.utils,
margaretha2df06602018-11-14 19:10:30 +010019 de.ids_mannheim.korap.authentication.http" />
20 <context:annotation-config />
21
22 <bean id="placeholders"
23 class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
24 <property name="ignoreResourceNotFound" value="true" />
25 <property name="locations">
26 <array>
27 <value>classpath:test-jdbc.properties</value>
28 <value>file:./test-jdbc.properties</value>
margaretha92ad2ec2023-05-15 14:10:00 +020029 <value>classpath:test-hibernate.properties</value>
margaretha2df06602018-11-14 19:10:30 +010030 <value>classpath:kustvakt-lite.conf</value>
31 <value>file:./kustvakt-lite.conf</value>
32 </array>
33 </property>
34 </bean>
35
36 <bean id="properties"
37 class="org.springframework.beans.factory.config.PropertiesFactoryBean">
38 <property name="ignoreResourceNotFound" value="true" />
39 <property name="locations">
40 <array>
41 <value>classpath:kustvakt-lite.conf</value>
42 <value>file:./kustvakt-lite.conf</value>
43 </array>
44 </property>
45 </bean>
46
47 <bean id="config" class="de.ids_mannheim.korap.config.KustvaktConfiguration">
48 <constructor-arg index="0" name="properties" ref="properties" />
49 </bean>
50
51 <!-- Database -->
52
margaretha6ff2a972023-09-21 14:54:39 +020053 <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
54 lazy-init="true">
55 <!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> -->
56 <property name="url" value="${jdbc.url}" />
57 <property name="username" value="${jdbc.username}" />
58 <property name="password" value="${jdbc.password}" />
59 <property name="maxTotal" value="4" />
60 <property name="maxIdle" value="1" />
61 <property name="minIdle" value="1" />
62 <property name="maxWaitMillis" value="15000" />
63 <!--<property name="poolPreparedStatements" value="true"/> -->
64 </bean>
65
margaretha2df06602018-11-14 19:10:30 +010066 <bean id="sqliteDataSource"
67 class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
68 lazy-init="true">
69 <property name="driverClassName" value="${jdbc.driverClassName}" />
70 <property name="url" value="${jdbc.url}" />
71 <property name="username" value="${jdbc.username}" />
72 <property name="password" value="${jdbc.password}" />
73 <property name="connectionProperties">
74 <props>
75 <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop>
76 </props>
77 </property>
78
79 <!-- relevant for single connection datasource and sqlite -->
80 <property name="suppressClose">
81 <value>true</value>
82 </property>
margaretha2df06602018-11-14 19:10:30 +010083 </bean>
84
margarethafcf8bd92021-01-14 10:55:53 +010085 <bean id="flywayConfig" class="org.flywaydb.core.api.configuration.ClassicConfiguration">
86 <property name="baselineOnMigrate" value="true" />
margaretha2df06602018-11-14 19:10:30 +010087 <!-- <property name="validateOnMigrate" value="false" /> -->
88 <!-- <property name="cleanOnValidationError" value="true" /> -->
margarethafcf8bd92021-01-14 10:55:53 +010089 <property name="locations" value="#{'${jdbc.schemaPath}'.split(',')}"/>
margaretha6ff2a972023-09-21 14:54:39 +020090 <property name="dataSource" ref="dataSource" />
margarethad66a6832022-03-03 08:47:13 +010091 <property name="outOfOrder" value="true" />
margaretha2df06602018-11-14 19:10:30 +010092 </bean>
margarethafcf8bd92021-01-14 10:55:53 +010093
94 <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
95 <constructor-arg ref="flywayConfig"/>
96 </bean>
margaretha2df06602018-11-14 19:10:30 +010097
98 <bean id="entityManagerFactory"
99 class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
margaretha6ff2a972023-09-21 14:54:39 +0200100 <property name="dataSource" ref="dataSource" />
margaretha2df06602018-11-14 19:10:30 +0100101
102 <property name="packagesToScan">
103 <array>
margaretha5b708792023-05-12 16:55:29 +0200104 <value>de.ids_mannheim.korap.core.entity</value>
margaretha2df06602018-11-14 19:10:30 +0100105 </array>
106 </property>
107 <property name="jpaVendorAdapter">
108 <bean id="jpaVendorAdapter"
109 class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
110 <property name="databasePlatform" value="${hibernate.dialect}" />
111 </bean>
112 </property>
113 <property name="jpaProperties">
114 <props>
115 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
116 <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
117 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
118 <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
119 <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
120 </prop>
121 <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop>
122 <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop>
123 <prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop>
124 </props>
125 </property>
126 </bean>
127 <tx:annotation-driven proxy-target-class="true"
128 transaction-manager="transactionManager" />
129
130 <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
131 <property name="entityManagerFactory" ref="entityManagerFactory" />
132 </bean>
133
134 <bean id="transactionTemplate"
135 class="org.springframework.transaction.support.TransactionTemplate">
136 <constructor-arg ref="transactionManager" />
137 </bean>
138 <bean id="txManager"
139 class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
140 <property name="dataSource" ref="sqliteDataSource" />
141 </bean>
142
margaretha4dee07a2022-05-27 11:45:28 +0200143 <!-- Search Engine -->
margaretha2df06602018-11-14 19:10:30 +0100144 <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
145 <constructor-arg value="${krill.indexDir}" />
146 </bean>
margaretha92ad2ec2023-05-15 14:10:00 +0200147
margaretha2df06602018-11-14 19:10:30 +0100148
149 <!-- Filters -->
margaretha4fa4b062019-01-28 19:43:30 +0100150 <!-- <bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
151 scope="singleton" /> -->
margaretha2df06602018-11-14 19:10:30 +0100152 <!-- Authentication -->
153 <bean id="authenticationManager"
154 class="de.ids_mannheim.korap.authentication.DummyAuthenticationManager" />
155
156 <!-- Response handler -->
157 <bean id="kustvaktResponseHandler" class="de.ids_mannheim.korap.web.KustvaktResponseHandler">
margaretha2df06602018-11-14 19:10:30 +0100158 </bean>
159
160 <!-- Controllers -->
margaretha92ad2ec2023-05-15 14:10:00 +0200161 <!-- added via component-scan
margaretha2df06602018-11-14 19:10:30 +0100162 <bean id="annotationController"
163 class="de.ids_mannheim.korap.web.controller.AnnotationController" />
164 <bean id="searchController" class="de.ids_mannheim.korap.web.controller.SearchController" />
165 <bean id="statisticController"
166 class="de.ids_mannheim.korap.web.controller.StatisticController" />
margaretha92ad2ec2023-05-15 14:10:00 +0200167 -->
margaretha2df06602018-11-14 19:10:30 +0100168 <!-- Services -->
margaretha2df06602018-11-14 19:10:30 +0100169 <bean id="scopeService"
170 class="de.ids_mannheim.korap.oauth2.service.DummyOAuth2ScopeServiceImpl" />
margaretha2df06602018-11-14 19:10:30 +0100171
172 <!-- DAO -->
173 <bean id="adminDao" class="de.ids_mannheim.korap.dao.DummyAdminDaoImpl" />
174 <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao" />
175
176 <!-- DTO Converter -->
177 <bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
178
179 <!-- Rewrite -->
margaretha92ad2ec2023-05-15 14:10:00 +0200180 <bean id="layerMapper" class="de.ids_mannheim.korap.rewrite.LayerMapper" />
margaretha4fa4b062019-01-28 19:43:30 +0100181 <bean id="foundryInject" class="de.ids_mannheim.korap.rewrite.FoundryInject" />
182
183 <util:list id="rewriteTasks" value-type="de.ids_mannheim.korap.rewrite.RewriteTask">
184 <ref bean="foundryInject" />
185 </util:list>
186
margaretha398f4722019-01-09 19:07:20 +0100187 <bean id="rewriteHandler" class="de.ids_mannheim.korap.rewrite.RewriteHandler">
margaretha4fa4b062019-01-28 19:43:30 +0100188 <constructor-arg ref="rewriteTasks" />
margaretha2df06602018-11-14 19:10:30 +0100189 </bean>
margaretha2df06602018-11-14 19:10:30 +0100190</beans>