最近在Spring官网上发现Spring 发布不久Spring项目已经是开始进行了
包括很多新功能如标题中提到的Restful的支持还有Servlet的支持等
大概总结了一下Spring中会包括以下一些新特性
Full scale REST support by means of additions to the Spring MVC API already pretty detailed and apparently going to be included in the first milestone release
Support for Unified EL (as seen in Spring Web Flow) very likely part of but no details given
Annotation support for declaring factory methods as above
Support for Portlet (JSR ) including resource requests (ResourceServingPortlet) as above
Preparations for Servlet specification sounded a lot like architectural preparations not visible to the consumer
Something to fill the gap between Spring Web Flow and Spring MVC that sounded very vague
Inclusion (probably generalisation) of the repeat retry and resume semantics provided by Spring Batch was only hinted at no details given
Inclusion of the OXM support provided by Spring WS sounded pretty definitive but no details given
Some kind of site definition language for the web stack no idea whether this is more than a rumour
Modelbased validation for use both in server and client as above
下面我们具体介绍一下Restful该特性
刚才我也提到了Spring是基于其目前提供的Spring MVC框架上引入对Rest的支持这样使其可以很好的融合到Spring中
下面有一段代码大家看了会更有体会
先看一下如何发布Rest风格的服务接口
@RequestMapping(value = /gadgets/{id}
method = RequestMethodGET)
public View getGadget(@PathParam String id) {
// 功能是根据 id 查询 Gadget对象
// 返回View对象
}
[] []