1. <?xml version="1.0" encoding="UTF-8"?>
2. <beans xmlns="http://www.springframework.org/schema/beans"
3. xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4. xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
5. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:rabbit="http://www.springframework.org/schema/rabbit"
6. xmlns:mvc="http://www.springframework.org/schema/mvc"
7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
9. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
10. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
11. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
12. http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
13. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd ">
14. <!--注册annotation -->
15. <context:annotation-config/>
16. <!-- 自动扫描controller -->
17. <context:component-scan base-package="com.mobanker.democenter.controller" name-generator="com.mobanker.framework.spring.mvc.FullPackageBeanNameGenerator">
18. <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
19. </context:component-scan>
20. <!-- mvc auto annotation driver -->
21. <mvc:annotation-driven conversion-service="conversionService">
22. <!--异步支持-->
23. <mvc:async-support default-timeout="10" task-executor="asyncTaskExecutor">
24. <mvc:callable-interceptors>
25. <bean class="com.mobanker.framework.server.netty.servlet.async.AsyncInterceptor"/>
26. </mvc:callable-interceptors>
27. </mvc:async-support>
28. <!--Configures one or more HttpMessageConverter types to use for converting @RequestBody method parameters and
29. @ResponseBody method return values. Using this configuration element is optional.
30. HttpMessageConverter registrations provided here will take precedence over HttpMessageConverter types registered
31. by default. Also see the register-defaults attribute if you want to turn off default registrations entirely-->
32. <mvc:message-converters register-defaults="true">
33. <ref bean="fastJsonHttpMessageConverter"/>
34. </mvc:message-converters>
35. </mvc:annotation-driven>
36. <!--异步executor-->
37. <bean id="asyncTaskExecutor" class="com.mobanker.framework.server.netty.servlet.async.ThreadLocalAsyncExecutor"/>
38. <!--转换器-->
39. <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
40. <property name="converters">
41. <set>
42. <bean class="com.mobanker.framework.convert.String2DateConverter"/>
43. <bean class="com.mobanker.framework.convert.Date2StringConverter"/>
44. </set>
45. </property>
46. </bean>
47. <!-- freemarker的配置 -->
48. <bean id="freemarkerConfigurer"
49. class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
50. <property name="templateLoaderPath" value="classpath:/templates/"/>
51. <property name="defaultEncoding" value="UTF-8"/>
52. <property name="freemarkerSettings">
53. <props>
54. <prop key="template_update_delay">10</prop>
55. <prop key="locale">zh_CN</prop>
56. <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
57. <prop key="date_format">yyyy-MM-dd</prop>
58. <prop key="number_format">#.##</prop>
59. </props>
60. </property>
61. </bean>
62. <!-- FreeMarker视图解析 ,在这里配置后缀名ftl和视图解析器 -->
63. <bean id="viewResolver"
64. class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
65. <property name="viewClass"
66. value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/>
67. <property name="suffix" value=".ftl"/>
68. <property name="contentType" value="text/html;charset=UTF-8"/>
69. <property name="exposeRequestAttributes" value="true"/>
70. <property name="exposeSessionAttributes" value="true"/>
71. <property name="exposeSpringMacroHelpers" value="true"/>
72. </bean>
73. <!--国际化-->
74. <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
75. <property name="basename" value="i18n/messages"/>
76. </bean>
77. <!-- 处理特殊映射包括增加contextPath -->
78. <bean name='requestMappingHandlerMapping' class='com.mobanker.framework.spring.mvc.PackageURLRequestMappingHandlerMapping'>
79. <property name='docBase' value='com.mobanker.democenter.controller'/>
80. <property name="contextPath" value="/demo/lait"/>
81. </bean>
82. <!-- 文件上传 -->
83. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
84. <property name="defaultEncoding" value="utf-8"/>
85. <property name="maxUploadSize" value="10485760000"/>
86. <property name="maxInMemorySize" value="40960"/>
87. <property name="uploadTempDir" value="file:///var/statics"/>
88. </bean>
89. <!--jsonConverter for httpMessageConverter-->
90. <bean id="fastJsonHttpMessageConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
91. <property name="supportedMediaTypes">
92. <list>
93. <value>application/json;charset=UTF-8</value>
94. </list>
95. </property>
96. </bean>
97. <!--<bean id="jsonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
98. <property name="supportedMediaTypes">
99. <list>
100. <value>application/json;charset=UTF-8</value>
101. </list>
102. </property>
103. </bean>-->
104. <!--<mvc:resources location="/" mapping="/*.txt"/>
105. <mvc:resources mapping="/images/**" location="/,classpath:/statics/images/"/>
106. <mvc:resources mapping="/js/**" location="/,classpath:/statics/js/" />
107. <mvc:resources mapping="/css/**" location="/,classpath:/statics/css/" />-->
108. <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 请求映射
109. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />-->
110. <!-- 多视图协商配置bean -->
111. <!-- <bean id="contentNegotiationManager"
112. class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
113. 扩展名至mimeType的映射,即 /*.json => application/json
114. <property name="favorPathExtension" value="true" />
115. <property name="favorParameter" value="true" />
116. <property name="parameterName" value="format" />
117. <property name="ignoreAcceptHeader" value="false" />
118. <property name="mediaTypes">
119. <value>
120. html=text/html
121. json=application/json
122. </value>
123. </property>
124. <property name="defaultContentType" value="text/html" />
125. </bean> -->
126. <!-- 多视图协商解析器 -->
127. <!-- <bean
128. class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
129. <property name="order" value="1"/>
130. <property name="contentNegotiationManager" ref="contentNegotiationManager" />
131. <property name="viewResolvers">
132. <list>
133. <ref bean="defaultViewResolver" />
134. <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
135. </list>
136. </property>
137. <property name="defaultViews">
138. <list>
139. <bean class="com.alibaba.fastjson.support.spring.FastJsonJsonView">
140. <property name="charset" value="UTF-8" />
141. </bean>
142. </list>
143. </property>
144. </bean> -->
145. <!-- <bean id="defaultViewResolver"
146. class="org.springframework.web.servlet.view.UrlBasedViewResolver">
147. <property name="viewClass"
148. value="org.springframework.web.servlet.view.JstlView" />
149. <property name="prefix" value="classpath:/resources/views/jsp/" />
150. <property name="suffix" value=".jsp" />
151. </bean> -->
152. </beans>
spring配置文件备份
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 一、Spring MVC文件上传配置 Spring MVC通过配置一个MultipartResolver来上传文件...
- 转载请注明来源 赖赖的博客 导语 学会如何获取资源和知识,才是学习的基础。 在spring-boot-01中我们简...
- spring boot默认配置文件后缀名可以是properties或yml 运行结果如下: 两个默认配置文件的内容...
- 0×1.实验拓扑图实验拓扑图如下:Cloud1被桥接到VMware的虚拟网卡vmnet1上,稍后会介绍如何桥接,v...
- 创建数据库用户 user:用户名 pwd:密码 db : 数据库名字 roles:指定用户的角色,可以用一个空数组...