blob: b342c59105310c1a96316378aa64c32b78e5292b [file] [log] [blame]
margaretha34954472018-10-24 20:05:17 +02001<?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">
13
14
15 <context:component-scan
16 base-package="de.ids_mannheim.korap.web.filter, de.ids_mannheim.korap.web.utils,
17 de.ids_mannheim.korap.authentication.http" />
18 <context:annotation-config />
19
20 <bean id="placeholders"
21 class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
22 <property name="ignoreResourceNotFound" value="true" />
23 <property name="locations">
24 <array>
25 <value>classpath:properties/lite-jdbc.properties</value>
26 <value>file:./lite-jdbc.properties</value>
27 <value>classpath:properties/hibernate.properties</value>
28 <value>classpath:kustvakt-lite.conf</value>
29 <value>file:./kustvakt-lite.conf</value>
30 </array>
31 </property>
32 </bean>
33
34 <bean id="properties"
35 class="org.springframework.beans.factory.config.PropertiesFactoryBean">
36 <property name="ignoreResourceNotFound" value="true" />
37 <property name="locations">
38 <array>
39 <value>classpath:kustvakt-lite.conf</value>
40 <value>file:./kustvakt-lite.conf</value>
41 </array>
42 </property>
43 </bean>
44
45 <bean id="config" class="de.ids_mannheim.korap.config.KustvaktConfiguration">
46 <constructor-arg index="0" name="properties" ref="properties" />
47 </bean>
48
49 <!-- Database -->
50
51 <bean id="sqliteDataSource"
52 class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
53 lazy-init="true">
54 <property name="driverClassName" value="${jdbc.driverClassName}" />
55 <property name="url" value="${jdbc.url}" />
56 <property name="username" value="${jdbc.username}" />
57 <property name="password" value="${jdbc.password}" />
58 <property name="connectionProperties">
59 <props>
60 <prop key="date_string_format">yyyy-MM-dd HH:mm:ss</prop>
61 </props>
62 </property>
63
64 <!-- relevant for single connection datasource and sqlite -->
65 <property name="suppressClose">
66 <value>true</value>
67 </property>
68 <!--<property name="initialSize" value="2"/> -->
69 <!--<property name="poolPreparedStatements" value="true"/> -->
70 </bean>
71
72 <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
73 <property name="baselineOnMigrate" value="true" />
74 <!-- <property name="validateOnMigrate" value="false" /> -->
75 <!-- <property name="cleanOnValidationError" value="true" /> -->
76 <property name="locations" value="${jdbc.schemaPath}" />
77 <property name="dataSource" ref="sqliteDataSource" />
78 </bean>
79
80 <bean id="entityManagerFactory"
81 class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
82 <property name="dataSource" ref="sqliteDataSource" />
83
84 <property name="packagesToScan">
85 <array>
86 <value>de.ids_mannheim.korap.entity</value>
87 <value>de.ids_mannheim.korap.oauth2.entity</value>
88 </array>
89 </property>
90 <property name="jpaVendorAdapter">
91 <bean id="jpaVendorAdapter"
92 class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
93 <property name="databasePlatform" value="${hibernate.dialect}" />
94 </bean>
95 </property>
96 <property name="jpaProperties">
97 <props>
98 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
99 <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
100 <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
101 <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
102 <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
103 </prop>
104 <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}</prop>
105 <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory}</prop>
106 <prop key="hibernate.jdbc.time_zone">${hibernate.jdbc.time_zone}</prop>
107 </props>
108 </property>
109 </bean>
110 <tx:annotation-driven proxy-target-class="true"
111 transaction-manager="transactionManager" />
112
113 <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
114 <property name="entityManagerFactory" ref="entityManagerFactory" />
115 </bean>
116
117 <bean id="transactionTemplate"
118 class="org.springframework.transaction.support.TransactionTemplate">
119 <constructor-arg ref="transactionManager" />
120 </bean>
121 <bean id="txManager"
122 class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
123 <property name="dataSource" ref="sqliteDataSource" />
124 </bean>
125
126 <!-- Initialization -->
127 <bean id="initializator" class="de.ids_mannheim.de.init.LiteInitializatorImpl"
128 init-method="init">
129 </bean>
130 <bean id="annotationParser" class="de.ids_mannheim.korap.annotation.AnnotationParser"
131 scope="singleton" />
132
133 <!-- Krill -->
134 <bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">
135 <constructor-arg value="${krill.indexDir}" />
136 </bean>
137
138 <!-- Filters -->
139 <bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
140 scope="singleton" />
141
142 <!-- Authentication -->
143 <bean id="authenticationManager"
144 class="de.ids_mannheim.korap.authentication.DummyAuthenticationManager" />
145
146 <!-- Response handler -->
147 <bean id="kustvaktResponseHandler" class="de.ids_mannheim.korap.web.KustvaktResponseHandler">
148 <constructor-arg index="0" name="iface" ref="kustvakt_auditing" />
149 </bean>
150
151 <!-- Controllers -->
152 <bean id="annotationController"
153 class="de.ids_mannheim.korap.web.controller.AnnotationController" />
154 <bean id="searchController" class="de.ids_mannheim.korap.web.controller.SearchController" />
155 <bean id="statisticController"
156 class="de.ids_mannheim.korap.web.controller.StatisticController" />
157
158 <!-- Services -->
159 <bean id="annotationService" class="de.ids_mannheim.korap.service.AnnotationService"></bean>
160 <bean id="scopeService"
161 class="de.ids_mannheim.korap.oauth2.service.DummyOAuth2ScopeServiceImpl" />
162 <bean id="searchService" class="de.ids_mannheim.korap.service.SearchService"></bean>
163
164 <!-- DAO -->
165 <bean id="adminDao" class="de.ids_mannheim.korap.dao.DummyAdminDaoImpl" />
166 <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao" />
167
168 <!-- DTO Converter -->
169 <bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
170
171 <!-- Rewrite -->
172 <bean id="rewriteHandler" class="de.ids_mannheim.korap.resource.rewrite.RewriteHandler">
173 <constructor-arg ref="config" />
174 </bean>
175
176
177
178 <bean id="kustvakt_auditing"
179 class="de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing">
180 </bean>
181
182</beans>