-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestcontext.xml
More file actions
80 lines (80 loc) · 4.58 KB
/
testcontext.xml
File metadata and controls
80 lines (80 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
">
<bean id="loonExceptionTranslatorImpl" class="uk.mafu.loon.exception.LoonExceptionTranslatorImpl" />
<bean id="HessianCleanerAspect" class="uk.mafu.loon.aop.HessianCleanerAspect">
<constructor-arg>
<ref bean="loonExceptionTranslatorImpl" />
</constructor-arg>
</bean>
<bean id="PermalinkAspect" class="uk.mafu.loon.aop.PermalinkAspect" />
<bean name="adminService" class="uk.mafu.loon.services.AdminServiceImpl">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<bean name="dataService" class="uk.mafu.loon.services.DataServiceImpl">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="uk.mafu.loon.custom.jpa.HibernateConfigurableJpaVendorAdapter">
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="${hibernate.dialect}" />
<entry key="hibernate.connection.username" value="${hibernate.connection.username}" />
<entry key="hibernate.connection.password" value="${hibernate.connection.password}" />
<entry key="hibernate.show_sql" value="${hibernate.show_sql}" />
<entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
<entry key="hibernate.generate_statistics" value="${hibernate.generate_statistics}" />
<entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
<entry key="hibernate.use_sql_comments" value="${hibernate.use_sql_comments}" />
<entry key="hibernate.c3p0.min_size" value="${hibernate.c3p0.min_size}" />
<entry key="hibernate.c3p0.max_size" value="${hibernate.c3p0.max_size}" />
<entry key="hibernate.c3p0.timeout" value="${hibernate.c3p0.timeout}" />
<entry key="hibernate.c3p0.max_statements" value="${hibernate.c3p0.max_statements}" />
<entry key="hibernate.c3p0.testConnectionOnCheckout"
value="${hibernate.c3p0.testConnectionOnCheckout}" />
</map>
</property>
</bean>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${hibernate.connection.driver_class}" />
<property name="url" value="${hibernate.connection.url}" />
<property name="username" value="${hibernate.connection.username}" />
<property name="password" value="${hibernate.connection.password}" />
</bean>
<bean id="adminTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<aop:config>
<aop:pointcut id="adminServicePointcut" expression="execution(* uk.mafu.loon.services.AdminServiceImpl.*(..))" />
<aop:pointcut id="dataServicePointcut" expression="execution(* uk.mafu.loon.services.DataServiceImpl.*(..))" />
<aop:advisor id="adminTxAdvisor" pointcut-ref="adminServicePointcut" advice-ref="adminTxAdvice" />
<aop:advisor id="adminTxAdvisor2" pointcut-ref="dataServicePointcut" advice-ref="adminTxAdvice" />
<aop:aspect ref="HessianCleanerAspect">
<aop:pointcut id="hessianCleanerPointcut"
expression="execution(* uk.mafu.loon.services.AdminServiceImpl.*(..))" />
<aop:around pointcut-ref="hessianCleanerPointcut" method="decorate" />
</aop:aspect>
<aop:aspect ref="PermalinkAspect">
<aop:pointcut id="permalinkPointcut"
expression="execution(* uk.mafu.loon.services.AdminServiceImpl.save(..))" />
<aop:around pointcut-ref="permalinkPointcut" method="decorate" />
</aop:aspect>
</aop:config>
<tx:advice id="adminTxAdvice" transaction-manager="adminTxManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
</beans>