※ Spring Frame Work 3.2 기준 실제 사용 했던 Servlet.xml



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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<?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:jee="http://www.springframework.org/schema/jee" 
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:task="http://www.springframework.org/schema/task" 
    xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/task
        http://www.springframework.org/schema/task/spring-task-3.2.xsd">
        
 
 
 
    <!-- The controllers are autodetected POJOs labeled with the @Controller, @Service, @Component annotation. -->
    <!-- @Controller, @Service, @Component annotation 아래의 package를 스켄하여 @Autowired 
        어노테이션을 이용하여 해당하는 엔티티 및 서비스를 맵핑한다. -->
    <!-- <context:component-scan base-package="com.isource.web.controller, com.isource.domain.service, 
        com.isource.web.validator, com.isource.web.security"/> -->
        
        
        
        
    
    <context:component-scan base-package="com.myPackage.web" />
    <mvc:resources location="/WEB-INF/resources/" mapping="/resources/**" />
 
 
    <context:annotation-config></context:annotation-config>
<!--     <task:executor id="taskExecutor" pool-size="5"/>
    <task:annotation-driven executor="taskExecutor"/> -->
    
    
 
    <!-- Annotation 기반 트랜잭션 설정 -->
    <tx:annotation-driven transaction-manager="oracleTransactionManager" />
 
    <!-- 트랜잭션 매니저 -->
    <bean id="oracleTransactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>
 
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:/mybatis/mybatisConfig.xml" />
        <property name="mapperLocations" value="classpath:/mybatis/sql/**/*.xml" />
    </bean>
 
    <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="sqlSessionFactory" />
    </bean>
    <bean id="sqlBatchSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="sqlSessionFactory" />
        <constructor-arg index="1" value="BATCH" />
    </bean>
 
    <bean id="anotherTransactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="anotherDataSource" />
    </bean>
 
    <bean id="anotherSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="anotherDataSource" />
        <property name="configLocation" value="classpath:/mybatis/mybatisConfig_another.xml" />
        <property name="mapperLocations" value="classpath:/mybatis/sql_another/**/*.xml" />
    </bean>
 
    <bean id="anotherSqlSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="anotherSqlSessionFactory" />
    </bean>
    
    <bean id="anotherBatchSqlSession" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="anotherSqlSessionFactory" />
        <constructor-arg index="1" value="BATCH" />
    </bean>
 
    <!-- Validation 활성화(validator="validator"), conversionService 활성화, 메세지 컨버터 
        등록 (JSON을 바꿔주는부분) -->
    <mvc:annotation-driven conversion-service="conversionService">
        <mvc:message-converters>
            <bean
                class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                <property name="objectMapper">
                    <bean class="com.myPackage.web.converter.CustomObjectMapper" />
                </property>
            </bean>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>text/html;charset=UTF-8</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
 
    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**" />
            <mvc:exclude-mapping path="/login**" />
            <mvc:exclude-mapping path="/login*" />
            <mvc:exclude-mapping path="/loginform**" />
            <mvc:exclude-mapping path="/resources/**" />
            <mvc:exclude-mapping path="/*.ico" />
            <bean class="com.isource.web.controller.IsourceInterceptor" />
        </mvc:interceptor>
 
        <bean id="localeChangeInterceptor"
            class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="convertLocale" />
        </bean>
    </mvc:interceptors>
    
    
    <bean id="localeResolver"
        class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
        <property name="defaultLocale" value="ko" />
    </bean>
    
 
    <!-- Configure the multipart resolver -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
            <!-- one of the properties available; the maximum file size in bytes about 
            10MB -->
        <property name="maxUploadSize" value="10000000" />
    </bean>
    <alias name="multipartResolver" alias="multipartResolver" />
 
    <!-- Configure the file upload directory -->
    <!-- <bean id="uploadDirResource" class="org.springframework.core.io.FileSystemResource"> 
        <constructor-arg> <value>C:/myPackage/upload/</value> </constructor-arg> </bean> -->
 
    <!-- tiles 2에서 전부처리되어 주석처리됨. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:order="2" p:prefix="/WEB-INF/views/" p:suffix=".jsp"/> -->
 
    <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver" p:order="1" p:viewClass="org.springframework.web.servlet.view.tiles2.TilesView" />
    <bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles/tiles-def.xml</value>
            </list>
        </property>
    </bean>
 
    <!-- @Valid 에서 스프링의 Message.properties를 사용하기 위해 추기 -->
    <bean id="validator"
        class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
        <property name="validationMessageSource" ref="messageSource" />
    </bean>
 
    <!-- Message -->
    <bean id="messageSource"
        class="com.myPackage.extendz.IscReloadableResourceBundleMessageSource">
        <!-- class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> -->
        <property name="defaultEncoding" value="UTF-8" />
        <property name="basenames">
            <list>
                <value>classpath:/messages/messages</value>
                <value>classpath:/messages/buttons</value>
                <value>classpath:/messages/labels</value>
            </list>
        </property>
    </bean>
 
    <!-- Exception 처리 -->
    <bean
        class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver">
        <property name="order" value="1" />
    </bean>
    
    
    <bean
        class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="order" value="2" />
        <property name="defaultErrorView" value="/common/error500" />
        <!--.main 은 타일즈 standalone layout 적용 -->
    </bean>
 
 
    <!-- Conversion Service 기본 포멧터 사용 -->
    <bean id="conversionService"
        class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
 
    <bean id="logDataSource_pos" class="net.sf.log4jdbc.Log4jdbcProxyDataSource">
        <constructor-arg ref="dataSource" />
        <property name="logFormatter">
            <bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter">
                <property name="loggingType" value="MULTI_LINE" />
                <property name="sqlPrefix" value="SQL=>" />
            </bean>
        </property>
    </bean>
 
 
    <!-- Quartz -->
    <bean id="batchService" class="com.myPackage.schedule.quartz.job.service.BatchService" />
    <bean id="sapJcoTransfer" class="com.myPackage.schedule.quartz.job.transfer.SapJcoTransfer" />
    <bean id="procedureTransfer" class="com.myPackage.schedule.quartz.job.transfer.ProcedureTransfer" />
    
 
     <bean name="isourceJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean" p:jobClass="com.isource.schedule.quartz.job.IsourceQuartzJobBean" p:durability="true">
        <property name="jobDataAsMap">
            <map>
                <entry key="batchService" value-ref="batchService" />
            </map>
        </property>
    </bean>
 
    <!-- <bean id="cronTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean" p:jobDetail-ref="isourceJob" p:startDelay="0" p:cronExpression="0/10 * * * * ?" /> -->
    
    <bean id="SimpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
        <property name="jobDetail" ref="isourceJob" />
        <property name="startDelay" value="0" />
        <property name="repeatInterval" value="604800000" /
    </bean>
    
          
          
          
          
    <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
                <ref bean="SimpleTrigger" />
            </list>
        </property>
    </bean>
    <bean class="com.myPackage.common.util.ApplicationContextAwareExtends"/>
    
    
    
    <bean class="com.myPackage.common.helper.mail.MailSendWorker">
        <constructor-arg>
            <ref bean="naverMailSender" />
        </constructor-arg>
    </bean>
    
    <!-- Gmail setting -->
    <bean name="gmailMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
            p:password="input your password"
            p:host="smtp.gmail.com"
            p:port="587"
            p:protocol="smtp"
            p:username="input your account"
            p:defaultEncoding="utf-8">
        <property name="javaMailProperties">
            <props>
                <prop key="mail.smtp.ssl.enable">false</prop>
                <prop key="mail.smtp.starttls.enable">true</prop>
                <prop key="mail.smtp.ssl.trust">*</prop>
                <prop key="mail.smtp.port">587</prop><!-- mail.smtp.ssl.enable true인 경우 주석처리후 사용 -->
                <prop key="mail.smtp.auth">true</prop>
                <prop key="mail.debug">true</prop>
            </props>
        </property>
    </bean>
    
    <!-- naver setting -->
    <bean name="naverMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
            p:password="input your password" 
            p:host="smtp.naver.com"
            p:port="465"
            p:protocol="smtps" 
            p:username="input your account"
            p:defaultEncoding="utf-8">
        <property name="javaMailProperties">
            <props>
                <prop key="mail.smtp.starttls.enable">true</prop>
                <prop key="mail.smtp.auth">true</prop>
                <prop key="mail.smtp.ssl.enable">true</prop>
                <prop key="mail.smtps.ssl.checkserveridentity">true</prop>
                <prop key="mail.smtps.ssl.trust">*</prop>
                <prop key="mail.debug">false</prop>
            </props>
        </property>
    </bean>
    
    <!-- Local Stmp setting -->
    <bean name="customMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
            p:host="smtp.mailplug.co.kr"
            p:protocol="SSL"
            p:defaultEncoding="utf-8">
        <property name="javaMailProperties">
            <props>
                <prop key="mail.smtp.port">465</prop>
                <prop key="mail.smtp.starttls.enable">false</prop>
                <prop key="mail.smtp.ssl.enable">true</prop>
                <prop key="mail.smtp.ssl.trust">*</prop>
                <prop key="mail.smtp.auth">true</prop>
                <prop key="mail.debug">true</prop>
            </props>
        </property>
        <!-- <property name="username" value="customSTMPUser"/>
        <property name="password" value="customSTMPPassword"/> -->
 
    </bean>
    
 
</beans>
 
cs


+ Recent posts