All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.spring-mvc.xml Maven / Gradle / Ivy

The newest version!
<?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:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
                        http://www.springframework.org/schema/beans/spring-beans-4.3.xsd  
                        http://www.springframework.org/schema/context  
                        http://www.springframework.org/schema/context/spring-context-4.3.xsd  
                        http://www.springframework.org/schema/mvc  
                        http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
                        http://www.springframework.org/schema/aop  
                        http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">

	<context:property-placeholder location="classpath:config/config.properties" />

	<mvc:annotation-driven />


	<context:component-scan
		base-package="com.github.zw201913.controller,com.github.zw201913.aspect" />

	<!-- spring mvc 能够访问静态内容 begin -->
	<mvc:resources location="/assets/" mapping="/assets/**" />
	<!-- spring mvc 能够访问静态内容 end -->

	<mvc:default-servlet-handler />
	<!-- 定义跳转的文件的前后缀 ,视图模式配置 -->
	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix">
			<value>/WEB-INF/views/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>

	<!-- 激活自动代理功能 -->
	<aop:aspectj-autoproxy proxy-target-class="true" />

	<bean id="fileAspect" class="com.github.zw201913.aspect.FileAspect"></bean>
	<aop:config>
		<aop:aspect id="time" ref="fileAspect">
			<aop:pointcut id="fileuploadPointCut"
				expression="execution(public * com.github.zw201913.controller.*.*.*(..))" />
			<aop:around method="upload" pointcut-ref="fileuploadPointCut" />
		</aop:aspect>
	</aop:config>

	<!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="defaultEncoding" value="UTF-8" />
		<!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
		<property name="maxUploadSize" value="-1" />
	</bean>

</beans>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy