美文网首页
springmvc注解驱动

springmvc注解驱动

作者: 浪白条 | 来源:发表于2019-04-30 15:41 被阅读0次

    模块装配@EnableWebMvc

    ```

    @Retention(RetentionPolicy.RUNTIME)

    @Target(ElementType.TYPE)

    @Documented

    @Import(DelegatingWebMvcConfiguration.class)

    public @interface EnableWebMvc {}

    ```

    DelegatingWebMvcConfiguration继承WebMvcConfigurationSupport

    WebMvcConfigurationSupport初始化了很多bean

    例如:RequestMappingHandlerMapping 

    /**

    * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping

    * requests to annotated controllers.

    */

    @Bean

    public RequestMappingHandlerMapping requestMappingHandlerMapping() {

    RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();

    。。。

    return mapping;

    }

    相关文章

      网友评论

          本文标题:springmvc注解驱动

          本文链接:https://www.haomeiwen.com/subject/jgvmnqtx.html