6ea229cf7a960750cc195be5449f578d4f270d5f
[JavaForFun] /
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:aop="http://www.springframework.org/schema/aop"
6        xsi:schemaLocation="http://www.springframework.org/schema/beans 
7                                                    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
8                                                    http://www.springframework.org/schema/aop 
9                                                    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
10                                                    http://www.springframework.org/schema/context 
11                                                    http://www.springframework.org/schema/context/spring-context-2.5.xsd
12                                                    http://www.springframework.org/schema/tx 
13                                                    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
14   
15      <aop:aspectj-autoproxy proxy-target-class="true"/>
16   
17          <context:load-time-weaver
18                 weaver-class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"
19                 aspectj-weaving="on"/>
20
21
22     <context:component-scan base-package="es.dia">
23         <context:include-filter 
24         type="annotation" 
25         expression="es.dia.pos.n2a.aspectj.annotations.TransactionalN2A" />
26         </context:component-scan>
27
28
29         <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
30                 <property name="user" value="root"/>
31                 <property name="password" value=""/>
32                 <property name="driverClass" value="com.mysql.jdbc.Driver"/>
33                 <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/n2a?autoReconnect=true"/>
34                 <property name="initialPoolSize" value="5"/>
35                 <property name="maxPoolSize" value="20"/>
36                 <property name="minPoolSize" value="10"/>
37                 <property name="acquireIncrement" value="1"/>
38                 <property name="acquireRetryAttempts" value="5"/>
39                 <property name="acquireRetryDelay" value="1000"/>
40                 <property name="automaticTestTable" value="con_test"/>
41                 <property name="checkoutTimeout" value="5000"/>
42         </bean>
43         
44         <bean id="annotationsHandler" class="es.dia.pos.n2a.aspectj.annotations.AnnotationsHandler" >
45         
46         </bean>
47         
48         <!--  
49         <bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect" factory-method="aspectOf">
50         <property name="transactionManagerN2A" ref="transactionManagerN2A"/>
51     </bean>     
52     -->
53     
54     <bean id="pruebaOuter" class="es.dia.pos.n2a.aspectj.annotations.Prueba"/>
55     <bean id="pruebaInner" class="es.dia.pos.n2a.aspectj.annotations.Prueba$InnerService">
56         <constructor-arg ref="pruebaOuter"/>
57     </bean>
58         
59         <!--
60                 I do not care about the N2A default configuration, so I use here the scope singleton and lazy-init false.
61         -->
62         <bean id="transactionManagerN2A" 
63                class="es.dia.pos.n2a.aspectj.annotations.TransactionManagerN2A"
64                factory-method="getInstance"
65                scope="singleton"
66                lazy-init="false" >
67         <property name="transactionManager">
68             <ref bean="transactionManager" />
69         </property>
70     </bean>
71     
72     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
73         <property name="dataSource" ref="dataSource"/>
74     </bean>
75
76 </beans>