androidannotations / androidannotations

Fast Android Development. Easy maintainance.
Other
11.06k stars 2.35k forks source link

@Rest: The converter class must be a subtype of org.springframework.http.converter.HttpMessageConverter RestClient.java #611

Closed studio4development closed 10 years ago

studio4development commented 11 years ago

When trying to define a rest template using the @Rest annotation, and when providing one or more "converters" in that annotation, I receive the following compile error:

The converter class must be a subtype of org.springframework.http.converter.HttpMessageConverter RestClient.java

When, in fact, I have tried to pass in GsonHttpMessageConverter.class and MappingJacksonHttpMessageConverter.class which are both such subtypes.

I have the following libraries included in my /libs directory

androidannotations-api-2.7.1.jar
gson-2.2.4.jar
jackson-core-asl-1.9.12.jar
jackson-mapper-asl-1.9.12.jar
spring-android-auth-1.0.1.RELEASE.jar
spring-android-core-1.0.1.RELEASE.jar
spring-android-rest-template-1.0.1.RELEASE.jar

I'm not sure if this is an issue with AndroidAnnotations or with my own setup, but help would be appreciated.

DayS commented 11 years ago

This should work... Could you give us some part of your code to see how you're using the Rest annotations ?

studio4development commented 11 years ago

@DayS This is my exact code where a compile error is being reported:

package com.affiliatemanager.rest;

import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;

import com.affiliatemanager.models.PromoRedemption;
import com.googlecode.androidannotations.annotations.rest.Get;
import com.googlecode.androidannotations.annotations.rest.Rest;

@Rest(rootUrl = "[my url omitted]", converters = { GsonHttpMessageConverter.class })
public interface RestClient 
{
    @Get("/promo/{pid}")
    PromoRedemption redeemPromo(String pid);

}
studio4development commented 11 years ago

@DayS any idea on this? I don't know what I'm supposed to do to fix this.

studio4development commented 11 years ago

Are there known issues between certain versions AndroidAnnotations and SpringAndroid? I've got 2.7.1 for AndroidAnnotations and 1.0.1 Release build for SpringAndroid...

DayS commented 11 years ago

I don't heard about this kind of issue between AA and SpringAndroid. As you said both GsonHttpMessageConverter and MappingJacksonHttpMessageConverter extends of HttpMessageConverter.

I also tried to compile your code with :

Everything works for me. Could you check that your dependencies are fine (version in the filename match the real version, etc...) ?

bini032 commented 11 years ago

same trouble... me too .. T^T help me

DayS commented 11 years ago

Do you still have this issue ? If not, I'll close this issue. Otherwise, could you provide us as much information as possible.

studio4development commented 11 years ago

Technically the issue still exists because nothing was ever changed or fixed. There really wasn't any more code involved than what I already posted, so its not possible to post more. I ended up reversing course and doing things the long way because this setup just would not work. I hope somebody figures something out so I can use Android Annotations for web service integration.

DayS commented 11 years ago

Ok, I'll try again to reproduce it then.

DayS commented 10 years ago

I'm closing this one as it seems to be a config issue, not an AA one.

Satyaranjan commented 9 years ago

its not working

WonderCsabo commented 9 years ago

@satyaranjan please elaborate...