<?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:p="http://www.springframework.org/schema/p"
	   xmlns:tx="http://www.springframework.org/schema/tx"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:com="http://www.springframework.org/schema/context"
	   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/tx http://www.springframework.org/schema/tx/spring-tx-2.5.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">
		<!--扫描所有用户自定义的控制器-->
		<context:component-scan base-package="com.hfxt.controller"/>
		<!--配置该标签会自动注册defaultAnnotationHandlerMapper(处理器映射)
		annotationMethodHanderAdapter(处理适配器) 这两个bean
		因为springmvc是通过这两个bean实现对注解controller和requestMapper支持-->
		<mvc:annotation-driven>
			<!--全局编码-->
			<mvc:message-converters>
				<bean class="org.springframework.http.converter.StringHttpMessageConverter">
					<property name="supportedMediaTypes">
						<list>
							<value>text/html;charset=UTF-8</value>
							<value>text/xml;charset=UTF-8</value>
							<value>text/plain;charset=UTF-8</value>
							<value>application/json;charset=UTF-8</value>
						</list>
					</property>
				</bean>
				<!--时间戳-->
				<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
					<!--yyyy-MM-dd hh:mm:ss-->
					<property name="features">
						<list>
							<value>WriteDateUseDateFormat</value>
						</list>
					</property>
				</bean>
			</mvc:message-converters>
		</mvc:annotation-driven>

		<!--创建视图解析  完成视图对应-->
		<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
			<property name="prefix" value="/"/>
			<property name="suffix" value=".jsp"/>
		</bean>
		<!--静态资源拦截-->
		<mvc:resources mapping="/statics/**" location="/statics/"></mvc:resources>
		<!--上传文件解析器-->
		<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
			<!--上传文件的最大大小,单位为字节-->
			<property name="maxUploadSize" value="1788884543"/>
			<!--上传文件的编码-->
			<property name="defaultEncoding" value="UTF-8"/>
		</bean>

</beans>

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐