What Spring Mvc--webapplicationcontext has done

Source: Internet
Author: User

in theThe default built-in WebapplicationcontextDispatcherservlet-dependent bean! We can make custom parameter settings for these beans based on the actual project needs. Because if our custom bean is present in the configuration file, then the default bean will be overwritten. The following is a detailed explanation of which beans are used by default in MVC. 1, handlermapping processing request mapping of the road strength2,handleradapter 3, Handlerexceptionresolver exception handling information, is the time you can customize the error message to which view to go<bean
class= " Org.springframework.web.servlet.handler.SimpleMappingExceptionResolver,
<property name= "exceptionmappings";
<props>
<!--no permissions-->
<prop key= " Org.apache.shiro.authz.UnauthorizedException ">ERROR</PROP>
<!--upload error-->
<prop
key = "Org.springframework.web.multipart.MaxUploadSizeExceededException" >ERROR_FILEUPLOAD</PROP>
</props>
</property>
Span style= "White-space:pre" > </bean> 4. Viewresolver View parser, customize the prefix and the suffix of the view file where you can configure the default view <bean
class= "Org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name= "prefix" value= "/" ></property>
<property name= "suffix" value= ". JSP" ></property>
</bean>
5. Localeresolver International Information View6, Themeresolver Theme Parser 7, Multipartresolver file Upload function, custom can use commons Io as a function of implementation<bean id= "Multipartresolver"
class= "Org.springframework.web.multipart.commons.CommonsMultipartResolver" >
<!--Specifies that the total size of the uploaded file cannot exceed 200KB. Note that the limit for the Maxuploadsize property is not for individual files, but for the sum of the capacity of all files.
<property name= "maxuploadsize" value= "200000"/>
</bean>
8, Flashmapmanager

What Spring Mvc--webapplicationcontext has done

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.