spring-config-servlet.xml
5.02 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
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
<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"
default-autowire="byName">
<!-- mvc controller -->
<context:component-scan base-package="com.dili.titan.web" />
<aop:aspectj-autoproxy proxy-target-class="true" />
<context:annotation-config />
<mvc:resources location="/assets/**" mapping="/assets/**" />
<mvc:default-servlet-handler/>
<!-- template view -->
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/views/" />
<property name="velocityProperties">
<props>
<prop key="input.encoding">UTF-8</prop>
<prop key="output.encoding">UTF-8</prop>
<prop key="contentType">text/html;charset=UTF-8</prop>
<prop key="velocimacro.library">common/macro.vm</prop>
<prop key="file.resource.loader.cache">false</prop>
<prop key="file.resource.loader.modificationCheckInterval">1</prop>
<prop key="velocimacro.library.autoreload">true</prop>
<prop key="eventhandler.referenceinsertion.class">org.apache.velocity.app.event.implement.EscapeHtmlReference</prop>
<prop key="eventhandler.escape.html.match">/^(?!.*\\$screen_content).*$/</prop>
</props>
</property>
</bean>
<bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
<property name="layoutUrl" value="layout/onlyContent.vm" />
<property name="cache" value="false" />
<property name="suffix" value=".vm" />
<property name="exposeSpringMacroHelpers" value="true" />
<property name="dateToolAttribute" value="dateTool" />
<property name="numberToolAttribute" value="numberTool" />
<!-- Merge urlBuilderMap to view context for convenience. You can put your tools which must be thread safe. -->
<property name="contentType" value="text/html;charset=UTF-8" />
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="defaultContentType" value="text/html" />
<!-- not by accept header -->
<property name="ignoreAcceptHeader" value="true" />
<!-- by extension -->
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml" />
<entry key="json" value="application/json" />
</map>
</property>
<property name="viewResolvers">
<list>
<ref bean="velocityViewResolver" />
</list>
</property>
<property name="defaultViews">
<list>
<!-- for application/json -->
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
</list>
</property>
</bean>
<!-- 文件上传 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8" />
</bean>
<!-- locale related -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieName" value="_clientlocale" />
<property name="defaultLocale" value="zh_CN" />
<property name="cookieMaxAge" value="2147483647" />
</bean>
<!-- Access resource bundles with the specified basename -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames" value="/WEB-INF/i18n/content,/WEB-INF/i18n/validation,/WEB-INF/i18n/asset,/WEB-INF/i18n/enum" />
<property name="cacheSeconds" value="5" />
</bean>
<bean id="webUtils" class="com.dili.titan.utils.WebUtils">
<property name="assetsPath" value="http://titan.dili.com/assets" />
</bean>
<bean id="nullTool" class="com.dili.titan.common.tools.NullTool" />
<bean id="moneyUtils" class="com.diligrp.website.util.format.MoneyUtils" />
<bean id="dateFormatUtils" class="com.dili.titan.common.utils.web.DateFormatUtils" />
<bean id="velocityTools" class="java.util.HashMap">
<constructor-arg>
<map>
<entry key="webUtils" value-ref="webUtils" />
<entry key="moneyUtils" value-ref="moneyUtils" />
<entry key="dateFormatUtils" value-ref="dateFormatUtils" />
<entry key="domain" value="http://titan.dili.com/" />
<entry key="null" value-ref="nullTool" />
</map>
</constructor-arg>
</bean>
<!-- log gathering 日志切面 -->
<bean id="logGatheringAdviser" class="com.diligrp.log.util.LogGatheringAdvisor" >
<constructor-arg name="system" value="titan_web_log"/>
</bean>
</beans>