<context:component-scan/> 扫描指定的包中的类上的注解,常用的注解有:
@Controller 声明Action组件
@Service 声明Service组件 @Service("myMovieLister")
@Repository 声明Dao组件
@Component 泛指组件, 当不好归类时.
@RequestMapping("/menu") 请求映射
@Resource 用于注入,( j2ee提供的 ) 默认按名称装配,@Resource(name="beanName")
@Autowired 用于注入,(srping提供的) 默认按类型装配
@Transactional( rollbackFor={Exception.class}) 事务管理
@ResponseBody
@Scope("prototype") 设定bean的作用域
<mvc:annotation-driven /> 是一种简写形式,完全可以手动配置替代这种简写形式,简写形式可以让初学都快速应用默认配置方案。<mvc:annotation-driven /> 会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean,是spring MVC为@Controllers分发请求所必须的。
并提供了:数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持,读写XML的支持(JAXB),读写JSON的支持(Jackson)。
后面,我们处理响应ajax请求时,就使用到了对json的支持。
后面,对action写JUnit单元测试时,要从spring IOC容器中取DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean,来完成测试,取的时候要知道是<mvc:annotation-driven />这一句注册的这两个bean。
如何替换 <mvc:annotation-driven />?他到底做了什么工作,请看,最后面的 十九节 <mvc:annotation-driven /> 到底做了什么工作。
<mvc:interceptors/> 是一种简写形式。通过看前面的大图,知道,我们可以配置多个HandlerMapping。<mvc:interceptors/>会为每一个HandlerMapping,注入一个拦截器。其实我们也可以手动配置为每个HandlerMapping注入一个拦截器。
<mvc:default-servlet-handler/> 使用默认的Servlet来响应静态文件。
<mvc:resources mapping="/images/**" location="/images/" cache-period="31556926"/> 匹配URL /images/** 的URL被当做静态资源,由Spring读出到内存中再响应http。
分享到:
相关推荐
springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明springboot常用注解说明...
微服务基础,springboot基础,常用注解等 微服务基础,springboot基础,常用注解等 微服务基础,springboot基础,常用注解等 微服务基础,springboot基础,常用注解等 微服务基础,springboot基础,常用注解等 ...
实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用注解demo实现mybatis常用...
springmvc常用注解标签详解,总结,常用注解,标签详解,springmvc
SpringMVC九大常用注解 SpringMVC
Spring MVC常用注解案例源代码
Spring Boot是一个开源框架,旨在简化Spring应用程序的创建和部署。它通过提供自动配置和约定优于配置的...通过了解这些常用注解的特性和使用方法,读者可以更有效地利用Spring Boot框架的功能,提高开发效率和质量。
Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点,Spring常用注解和扩展点
SpringMVC 常用注解类,视频讲解,带课程文档。SpringMVC 常用注解类
cxf实现webservice 常用注解总结,本文档包括cxf实现webservice是用到所有注解,请大家参考
cxf常用注解doc。全面注解。高效学习。欢迎下载。
Spring常用注解(收藏大全).docx
Spring Boot 常用注解.rar
Spring 常用注解整理,分类:创建对象;注入数据;范围;全局异常;生命周期;新注解;JPA;扩展原理等注解类型。
Spring MVC常用注解及源码分析,详细介绍各个注解的使用常用以及实现原理分析
springboot常用注解.markdown
2、webservice--常用注解1
本篇文章将介绍几种SpringBoot 中常用注解及各个注解的作用,感兴趣的朋友跟随脚本之家小编一起学习吧
Spring常用注解