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"
|
4
|
xmlns:context="http://www.springframework.org/schema/context"
|
5
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
6
|
xmlns:security="http://www.springframework.org/schema/security"
|
7
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
8
|
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
9
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
|
10
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
|
11
|
http://www.springframework.org/schema/security
|
12
|
http://www.springframework.org/schema/security/spring-security-3.0.4.xsd">
|
13
|
|
14
|
<!-- <import resource="classpath:/eu/etaxonomy/cdm/defaultSecurityContext.xml"/> -->
|
15
|
|
16
|
<!--<import resource="classpath:/eu/etaxonomy/cdm/persistence.xml"/> -->
|
17
|
|
18
|
<context:component-scan base-package="eu/etaxonomy/cdm/persistence">
|
19
|
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.persistence\.dao\.hibernate\.taxon\.TaxonAlternativeSpellingSuggestionParser"/>
|
20
|
</context:component-scan>
|
21
|
<context:component-scan base-package="eu/etaxonomy/cdm/database"/>
|
22
|
|
23
|
<!-- includes service beans e.g. in eu/etaxonomy/cdm/api -->
|
24
|
<context:component-scan base-package="eu/etaxonomy/cdm/api/service">
|
25
|
<!-- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.api\.service\.UserService"/> -->
|
26
|
</context:component-scan>
|
27
|
|
28
|
<context:component-scan base-package="eu/etaxonomy/cdm/api/application"/>
|
29
|
|
30
|
<!-- enable the configuration of transactional behavior based on annotations -->
|
31
|
<tx:annotation-driven transaction-manager="transactionManager"/>
|
32
|
|
33
|
<bean id="transactionManager"
|
34
|
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
|
35
|
<property name="sessionFactory" ref="sessionFactory"/>
|
36
|
</bean>
|
37
|
|
38
|
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
|
39
|
<property name="namingStrategy">
|
40
|
<bean class="org.hibernate.cfg.DefaultComponentSafeNamingStrategy" />
|
41
|
</property>
|
42
|
|
43
|
<property name="configLocation" value="classpath:eu/etaxonomy/cdm/hibernate.cfg.xml"/>
|
44
|
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
|
45
|
<property name="dataSource" ref="dataSource"/>
|
46
|
<property name="hibernateProperties" ref="hibernateProperties"/>
|
47
|
</bean>
|
48
|
|
49
|
|
50
|
<bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
|
51
|
|
52
|
<bean id="hibernateProperties"
|
53
|
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
54
|
<property name="properties">
|
55
|
<props>
|
56
|
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLCorrectedDialect</prop>
|
57
|
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
|
58
|
<!-- TODO trying to use a managed session context -->
|
59
|
<!-- <prop key="hibernate.current_session_context_class">managed</prop>-->
|
60
|
<prop key="hibernate.show_sql">false</prop>
|
61
|
<prop key="hibernate.format_sql">false</prop>
|
62
|
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
|
63
|
<prop key="hibernate.search.default.indexBase">./target/test-classes</prop>
|
64
|
</props>
|
65
|
</property>
|
66
|
</bean>
|
67
|
|
68
|
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
|
69
|
<property name="providers">
|
70
|
<list>
|
71
|
<bean class="org.springframework.security.authentication.TestingAuthenticationProvider"/>
|
72
|
<ref local="daoAuthenticationProvider"/>
|
73
|
</list>
|
74
|
</property>
|
75
|
</bean>
|
76
|
|
77
|
<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
|
78
|
<property name="userDetailsService" ref="userService"/>
|
79
|
<property name="saltSource" ref="saltSource"/>
|
80
|
<property name="passwordEncoder" ref="passwordEncoder"/>
|
81
|
</bean>
|
82
|
|
83
|
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>
|
84
|
|
85
|
<bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">
|
86
|
<property name="userPropertyToUse" value="getUsername"/>
|
87
|
</bean>
|
88
|
|
89
|
<security:global-method-security pre-post-annotations="enabled">
|
90
|
<security:expression-handler ref="expressionHandler"/>
|
91
|
</security:global-method-security>
|
92
|
|
93
|
<bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
|
94
|
<property name="permissionEvaluator" ref="cdmPermissionEvaluator"/>
|
95
|
</bean>
|
96
|
|
97
|
|
98
|
<bean class="eu.etaxonomy.cdm.permission.CdmPermissionEvaluator" id="cdmPermissionEvaluator"/>
|
99
|
|
100
|
<bean id="userService" class="eu.etaxonomy.cdm.api.service.UserService">
|
101
|
|
102
|
</bean>
|
103
|
|
104
|
|
105
|
<bean id="groupService" class="eu.etaxonomy.cdm.api.service.GroupServiceImpl">
|
106
|
|
107
|
</bean>
|
108
|
<bean id="taxonService" class="eu.etaxonomy.cdm.api.service.TaxonServiceImpl">
|
109
|
|
110
|
</bean>
|
111
|
<bean id="descriptionService" class="eu.etaxonomy.cdm.api.service.DescriptionServiceImpl">
|
112
|
|
113
|
</bean>
|
114
|
<bean id="titleCacheAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.TitleCacheAutoInitializer"></bean>
|
115
|
|
116
|
<bean id="defaultBeanInitializer" class="eu.etaxonomy.cdm.persistence.dao.hibernate.HibernateBeanInitializer">
|
117
|
<property name="beanAutoInitializers">
|
118
|
<map>
|
119
|
<entry key="eu.etaxonomy.cdm.model.common.IdentifiableEntity" value-ref="titleCacheAutoInitializer" />
|
120
|
</map>
|
121
|
</property>
|
122
|
</bean>
|
123
|
</beans>
|