source: ComponentRegistry/trunk/ComponentRegistry/src/main/resources/spring-config/applicationContext.xml @ 4098

Last change on this file since 4098 was 4098, checked in by George.Georgovassilis@mpi.nl, 10 years ago

#360, #431, #432: JPA and unified component entities

  • Property svn:executable set to *
  • Property svn:mime-type set to text/plain
File size: 5.3 KB
Line 
1<?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:aop="http://www.springframework.org/schema/aop"
4        xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
5        xmlns:jpa="http://www.springframework.org/schema/data/jpa"
6        xsi:schemaLocation="
7     http://www.springframework.org/schema/beans
8     http://www.springframework.org/schema/beans/spring-beans.xsd
9     http://www.springframework.org/schema/aop
10     http://www.springframework.org/schema/aop/spring-aop.xsd
11     http://www.springframework.org/schema/tx
12     http://www.springframework.org/schema/tx/spring-tx.xsd
13     http://www.springframework.org/schema/context
14     http://www.springframework.org/schema/context/spring-context.xsd
15     http://www.springframework.org/schema/data/jpa
16         http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
17     ">
18
19        <context:annotation-config />
20        <context:component-scan base-package="clarin.cmdi.componentregistry" />
21        <!-- target class proxying must be enabled, otherwise Jersey won't find
22                the @path annotations on ComponentRegistryRestService -->
23        <tx:annotation-driven proxy-target-class="true" />
24        <jpa:repositories base-package="clarin.cmdi.componentregistry.persistence.jpa" />
25
26        <!-- Load properties from context.xml via servlet container -->
27        <bean
28                class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
29                <property name="ignoreUnresolvablePlaceholders" value="true" />
30        </bean>
31
32        <!-- Fallback properties for unit tests, loads properties from /test/γ -->
33        <bean
34                class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
35                <property name="location"
36                        value="classpath:spring-config/component-registry.properties" />
37                <property name="ignoreResourceNotFound" value="true" />
38        </bean>
39
40        <bean id="mdMarshaller" class="clarin.cmdi.componentregistry.MDMarshaller" />
41
42        <bean id="configuration" class="clarin.cmdi.componentregistry.Configuration"
43                factory-method="getInstance">
44                <!-- Read admin users from init param -->
45                <property name="adminUsersList"
46                        value="${eu.clarin.cmdi.componentregistry.adminUsers}" />
47                <property name="generalComponentSchema"
48                        value="${eu.clarin.cmdi.componentregistry.generalComponentSchemaUrl}" />
49                <property name="component2SchemaXsl"
50                        value="${eu.clarin.cmdi.componentregistry.component2SchemaXslUrl}" />
51                <property name="componentSpecSchemaLocation"
52                        value="${eu.clarin.cmdi.componentregistry.componentSpecSchemaLocation}" />
53                <property name="isocatRestUrl"
54                        value="${eu.clarin.cmdi.componentregistry.isocatRestUrl}" />
55                <!-- Extra attribute keys that are passed in a shibboleth authenticated
56                        request principal. You need to configure the shhaa.xml file to enable the
57                        extra attributes. -->
58                <property name="displayNameShibbolethKeys">
59                        <list>
60                                <value>displayName</value>
61                                <value>commonName</value>
62                        </list>
63                </property>
64        </bean>
65
66        <bean id="componentsCache"
67                class="clarin.cmdi.componentregistry.impl.database.CMDComponentSpecCache" />
68        <bean id="profilesCache"
69                class="clarin.cmdi.componentregistry.impl.database.CMDComponentSpecCache" />
70
71        <!-- Prototype bean for component registry (service) -->
72        <bean id="componentRegistry"
73                class="clarin.cmdi.componentregistry.impl.database.ComponentRegistryDbImpl"
74                scope="prototype" />
75
76        <!-- Factory that will create component registries for us (and autowire
77                them), to be used by actual ComponentRegistryFactory -->
78        <bean id="componentRegistryBeanFactory"
79                class="org.springframework.beans.factory.config.ServiceLocatorFactoryBean">
80                <property name="serviceLocatorInterface"
81                        value="clarin.cmdi.componentregistry.impl.database.ComponentRegistryBeanFactory" />
82        </bean>
83
84        <!-- Component registry factory that will be used by rest service to get
85                user and public registries -->
86        <bean id="componentRegistryFactory"
87                class="clarin.cmdi.componentregistry.impl.database.ComponentRegistryFactoryDbImpl"></bean>
88
89
90        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
91                <property name="entityManagerFactory" ref="entityManagerFactory" />
92                <property name="dataSource" ref="applicationServerDataSource"/>
93        </bean>
94       
95        <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
96                <property name="dataSource" ref="dataSource" />
97        </bean>
98
99        <bean id="entityManagerFactory"
100                class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
101                <property name="dataSource" ref="dataSource" />
102                <property name="jpaVendorAdapter">
103                        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
104                                <property name="generateDdl" value="true" />
105                        </bean>
106                </property>
107                <property name="jpaDialect">
108                <bean class="clarin.cmdi.componentregistry.impl.database.PostgresJpaDialect"/>
109                </property>
110                <property name="persistenceUnitName" value="clarin.cmdi.componentregistry" />
111                <property name="jpaProperties">
112                        <props>
113                                <prop key="hibernate.dialect">${eu.clarin.cmdi.componentregistry.jpaDialect}</prop>
114                                <prop key="hibernate.show_sql">false</prop>
115                                <!-- prop key="hibernate.hbm2ddl.auto">update</prop -->
116                        </props>
117
118                </property>
119        </bean>
120
121        <!-- Unit tests reload the same beans over and over -->
122        <context:mbean-export registration="replaceExisting" />
123
124</beans>
Note: See TracBrowser for help on using the repository browser.