Spring MVC Java配置有关的类/注解

  1. 缺省配置类 : WebMvcConfigurationSupport
    该类提供缺省的Spring MVC配置,主要表现为定义如下beanSpring MVC运行时使用 :

    • RequestMappingHandlerMapping requestMappingHandlerMapping()
    • PathMatcher mvcPathMatcher()
    • UrlPathHelper mvcUrlPathHelper()
    • ContentNegotiationManager mvcContentNegotiationManager()
    • HandlerMapping viewControllerHandlerMapping()
    • BeanNameUrlHandlerMapping beanNameHandlerMapping()
    • HandlerMapping resourceHandlerMapping()
    • ResourceUrlProvider mvcResourceUrlProvider()
    • HandlerMapping defaultServletHandlerMapping()
    • RequestMappingHandlerAdapter requestMappingHandlerAdapter()
    • FormattingConversionService mvcConversionService()
    • Validator mvcValidator()
    • CompositeUriComponentsContributor mvcUriComponentsContributor()
    • HttpRequestHandlerAdapter httpRequestHandlerAdapter()
    • SimpleControllerHandlerAdapter simpleControllerHandlerAdapter()
    • HandlerExceptionResolver handlerExceptionResolver()
    • ViewResolver mvcViewResolver()
    • HandlerMappingIntrospector mvcHandlerMappingIntrospector()
  2. 缺省Spring MVC配置引入注解 : @EnableWebMvc
    使用该注解会引入缺省的Spring MVC配置。该注解通常用在某个配置类上,也就是结合@Configuration使用。

  3. Spring MVC配置定制器接口定义 : WebMvcConfigurer
    让某些配置类变成Spring MVC配置的一个定制器。用于被使用@Configuration注解的配置类实现,从而使该配置类成为一个Spring MVC配置定制器。

  4. Spring MVC配置委托定制配置类 : DelegatingWebMvcConfiguration
    DelegatingWebMvcConfiguration继承自WebMvcConfigurationSupport,也就是说它自身相当于WebMvcConfigurationSupport用于提供Spring MVC缺省配置。

    另外DelegatingWebMvcConfiguration本身也是配置类(使用了注解@Configuration),也会被注入一组WebMvcConfigurer对象,这些对象通常来自开发人员或者框架提供的WebMvcConfigurer实现类:使用注解@Configuration的配置类,同时实现了接口WebMvcConfigurer。来自框架的WebMvcConfigurer实现类的例子比如SpringDataWebConfiguration

    DelegatingWebMvcConfiguration会结合Spring MVC缺省配置和所注入的WebMvcConfigurer配置类合成最终运行时使用的Spring MVC配置。

相关文章

Spring MVC 代理配置类 DelegatingWebMvcConfiguration

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值