I've just installed AndroidAnnotations and I want to use the @Rest
annotation, however, as I read:
You MUST define converters field on this @Rest annotation, which corresponds to the Spring HttpMessageConverters that will be provided to the RestTemplate.
So, where to get MappingJackson2HttpMessageConverter
? and how to install it?
Or at least, to convert my expected json string into a json object? Is there any simple example?
Thanks
As it is written in the documentation, you have to add the Spring REST template dependency, which is the underlying REST library, AA is just a wrapper around it.
You can do it by adding this to your build.gradle
.
dependencies {
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
} repositories {
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
Now you can add any converter, like it is outlined in the doc:
@Rest(converters = { MappingJackson2HttpMessageConverter.class })
public interface MyRestClient {
@Get("/events")
EventList getEvents();
}