设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 技术文摘 查看内容

Spring for Android:用于Android开发的Spring组件

2014-8-22 14:40| 发布者: joejoe0332| 查看: 3657| 评论: 0|原作者: 黄余粮|来自: jobbole.com

摘要: Spring项目包括很多组件,Spring for Android就是其中之一,它用于Android App开发。和所有Spring项目一样,Spring for Android的强大之处在于易扩展性。

  Spring项目包括很多组件,Spring for Android就是其中之一,它用于Android App开发。和所有Spring项目一样,Spring for Android的强大之处在于易扩展性。


特性

> Android应用的Rest客户端
> Auth授权验证


快速上手

  在项目中使用spring-android时,我们推荐方式是以依赖管理系统作为开始,你可以拷贝并粘贴下面的代码片段到你的build中。如果有问题,请查看用Maven和Gradle构建入门指南。


1
2
3
4
5
6
7
8
9
10
11
org.springframework.android
spring-android-rest-template
1.0.1.RELEASE
 
org.springframework.android
spring-android-auth
1.0.1.RELEASE
 
org.springframework.android
spring-android-core
1.0.1.RELEASE


  应用范例(如何通过Google搜索)

1
2
3
4
5
6
7
8
9
// The connection URL
 String url = "https://ajax.googleapis.com/ajax/" +
 "services/search/web?v=1.0&q={query}";
// Create a new RestTemplate instance
 RestTemplate restTemplate = new RestTemplate();
// Add the String message converter
 restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
// Make the HTTP GET request, marshaling the response to a String
 String result = restTemplate.getForObject(url, String.class, "Android");


  官网地址:http://projects.spring.io/spring-android/


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部