liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?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:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee"
    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/aop
                        http://www.springframework.org/schema/aop/spring-aop-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/jee
                        http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
                        http://www.springframework.org/schema/tx
                        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
 
    <context:property-placeholder location="classpath:jdbc.properties, classpath:mail.properties, classpath:basenames.properties"/>
 
    <!-- JNDI DataSource for J2EE environments -->
    <!--
    <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/landy" />
    -->
 
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}"  />
        <property name="url" value="${jdbc.url}"  />
        <property name="username" value="${jdbc.username}"  />
        <property name="password" value="${jdbc.password}"  />
        <property name="maxActive" value="100"  />
        <property name="maxWait" value="1000" />
        <property name="poolPreparedStatements" value="true" />
        <property name="defaultAutoCommit" value="true" />
    </bean>
 
    <!-- 
    <bean id="multiDataSource" class="com.landy.framework.core.support.MultiDataSource">
        <property name="targetDataSources">
            <map>
                <entry key="dataSource1" value-ref="dataSource1" />
                <entry key="dataSource2" value-ref="dataSource2" />
            </map>
        </property>
        <property name="defaultTargetDataSource" ref="dataSource" />
    </bean>
     -->
 
<!--     <bean id="myInterceptor" class="com.landy.gum.interceptor.HibernateInterceptor"/> -->
    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <!-- <property name="entityInterceptor">
            <ref bean="myInterceptor"/>
        </property> -->
        <property name="annotatedPackages">
            <list>
                <value>com.landy.framework.core.model</value>
            </list>
        </property>
        <property name="annotatedClasses">
            <bean class="com.landy.framework.core.support.HibernateEntityClassesFactoryBean" />
        </property>
        <property name="mappingLocations">
            <bean class="com.landy.framework.core.support.HibernateMappingLocationsFactoryBean" />
        </property>
        <property name="hibernateProperties">
            <value>
                hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
                hibernate.query.substitutions=true 'Y', false 'N'
                hibernate.cache.use_second_level_cache=true
                hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
                hibernate.jdbc.fetch_size=50
                hibernate.jdbc.batch_size=25
                hibernate.show_sql=true
                hibernate.format_sql=true
                hibernate.use_sql_comments=true
            </value>
        </property>
        <property name="lobHandler" ref="lobHandler" />
    </bean>
 
    <bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler">
        
    </bean>
    
    <bean class="com.landy.gum.start.HaveGlobalCache"/>
 
    <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" />
 
    <!-- Transaction manager for a single Hibernate SessionFactory -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
 
    <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
        <property name="customEditors">
            <map>
                <entry key="java.util.Date">
                    <bean class="com.landy.framework.core.support.CustomDateEditor" />
                </entry>
                <entry key="java.lang.String[]">
                    <bean class="com.landy.framework.core.support.CustomStringArrayEditor" />
                </entry>
            </map>
        </property>
    </bean>
 
    
    <bean class="com.landy.framework.core.support.ApplicationContextRegister" />
    
 
    <bean id="cookieLocaleResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
        <property name="cookieName" value="LANDY_CUSTOM_LOCALE_COOKIE" />
    </bean>
 
                
    
 
    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basenames" value="${basenames}" />
        <property name="useCodeAsDefaultMessage" value="true" />
    </bean>
 
    <bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host" value="${mail.host}" />
        <property name="defaultEncoding" value="UTF-8" />
        <property name="username" value="${mail.username}" />
        <property name="password" value="${mail.password}" />
        <property name="javaMailProperties">
            <value>
                mail.smtp.auth=true
            </value>
        </property>
    </bean>
    
    
     
 
    <!-- 
    <bean id="multicastService" class="com.landy.framework.core.support.ClusterServiceInvoker">
        <property name="groupAddress" value="225.0.0.1" />
        <property name="port" value="6789" />
        <property name="messageBufferSize" value="1024" />
    </bean>
     -->
 
    <!-- Enable annotation-based configuration -->
    <context:annotation-config />
 
    <!-- Enable classpath scanning for managed components -->
    <context:component-scan base-package="com.landy"
                            name-generator="com.landy.framework.core.support.CustomBeanNameGenerator" />
 
    <!-- Enable @AspectJ support -->
    <aop:aspectj-autoproxy />
 
    <!-- Enable @Transactional support -->
    <tx:annotation-driven />
 
</beans>