spring MVC 中为什么要加一个HandlerAdapter

在学习 开涛的Spring MVC 有一处不明白,就是 spring MVC 中为什么要加一个HandlerAdapter?

















上面的配置中,通过/hello这个url的映射已经可以找到对应的HelloWorldController,直接调用其方法不行吗?
为什么要加一层 HandlerAdapter,然后通过HandlerAdapter 来调用 Controller的控制方法?

请大家不吝赐教
谢谢

--------------------------------
找到答案,参考 [url]http://stackoverflow.com/questions/23325111/spring-mvc-handlermapping-vs-handleradapter[/url]

Since introduction of RequestMappingHandlerMapping and RequestMappingHandlerAdapter in Spring 3.1 the distinction is even simpler: RequestMappingHandlerMapping finds the appropriate handler method for the given request. RequestMappingHandlerAdapter executes this method, providing it with all the arguments.

你可能感兴趣的:(spring MVC 中为什么要加一个HandlerAdapter)