springboot 定义RequestMappingHandlerMapping bean
时间: 2023-11-10 18:57:39 浏览: 151
在Spring Boot中,默认的RequestMappingHandlerMapping bean会扫描项目目录下的所有带有@Controller和@RequestMapping注解的类进行处理。如果你想自定义RequestMappingHandlerMapping bean,你可以创建一个继承自DelegatingWebMvcConfiguration的配置类,并重写createRequestMappingHandlerMapping方法来返回自定义的RequestMappingHandlerMapping实例。如果你想在自定义的RequestMappingHandlerMapping中过滤掉一些不需要对外提供路径的类,你可以重写isHandler方法,并根据自己的需求来判断是否将某个类作为handler。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [SpringBoot 自定义RequestMappingHandlerMapping](https://blog.csdn.net/TangKenny/article/details/114691584)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文