设为首页 加入收藏

TOP

SpringMVC_HandlerMethodArgumentResolver 实践(二)
2019-10-11 11:19:55 】 浏览:49
Tags:SpringMVC_HandlerMethodArgumentResolver 实践
tp://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!-- 基本包扫描 --> <context:component-scan base-package="com.spring" /> <!-- 注册HandlerMapper、HandlerAdapter两个映射类,负责将请求映射到类和方法中 --> <mvc:annotation-driven> <mvc:argument-resolvers> <bean class="com.spring.custom_anno.CurrentUserMethodArgumentResolver"/> </mvc:argument-resolvers> </mvc:annotation-driven> <mvc:annotation-driven /> <!-- 访问静态资源,如js, css文件等 --> <mvc:default-servlet-handler /> <!-- 视图解析器 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"></property> <property name="suffix" value=".jsp"></property> </bean> </beans> View Code

2.(springboot)

只需要在CurrentUserMethodArgumentResolver 类上加上@Component就行了。

 

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇死磕 java线程系列之自己动手写一.. 下一篇Java连载38-对象封装性格式、构造..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目