Engineering
Releases
News and Events

Spring for Android 2.0.0.M1 released

I am pleased to announce that Spring for Android 2.0.0.M1 is now available in the Spring milestone repository. Highlights include:

  • Generics support through the use of ParameterizedTypeReference
  • Support for OkHttp via OkHttpRequestFactory
  • RestTemplate API parity with Spring Framework
  • Bug fixes and improvements

Minimum Version

This release raises the minimum version from Android 2.1 (API level 7) to Android 2.2 (API level 8). The Google Play Store app is no longer supported on Android 2.1 and that version is not being tracked on the Android developer Dashboards. Additionally, OkHttp is only supported on Android 2.3 and newer.

Generic Types

The following is an example of how to consume generic types with Rest Template:

ParameterizedTypeReference<List<String>> typeRef = 
        new ParameterizedTypeReference<List<String>>() {};

ResponseEntity<List<String>> responseEntity = 
        restTemplate.exchange(url, HttpMethod.GET, requestEntity, typeRef);

List<String> strings = responseEntity.getBody();

API Parity

In order to maintain parity with Spring Framework’s Rest Template library, this release introduces a few breaking changes. Specifically, note the RestTemplate constructors have changed. The default constructor now creates a standard set of HttpMessageConverters. The recommended way to prevent default message converters from being created is to use the following new constructor:

public RestTemplate(List<HttpMessageConverter<?>> messageConverters)

Conclusion

For a complete list of changes, see the Release Notes in JIRA. The reference documentation has also been updated to cover the new features.

Thanks again to everyone that has contributed to the release! Please try this new milestone and report any problems in JIRA or on GitHub.

comments powered by Disqus