如何在feign client spriong Boot中设置值

问题描述

在邮递员中,我可以通过以下方式通过对 influxDb 的查询成功执行以下 rest api:

https://test-jon.alice.it:58799/query?db=edms_db&q=SELECT * FROM M_M WHERE time> Now () - 6m LIMIT 5 

现在,在我的 Spring Boot 项目中,我试图以这种方式在伪装客户端界面中使用它:

@FeignClient(name = "feignClient",url = "https://edms-dev.aceaspa.it:30223")
public interface FeignClientInfluxDB {

    @SuppressWarnings("rawtypes")
    @RequestMapping(method = RequestMethod.GET,value = "/query?db=edms_db&q=SELECT * FROM Monterotondo_Marittimo WHERE time > Now() - 6m LIMIT 5")
    List<M_MEntity> getAllDataFromInfluxDBwithTimeCondiction(
            @RequestHeader(name = "Authorization") String token);   
}

这是我在 Service 类中使用 feignClient 方法的 getAll 方法

@Transactional
public List<M_MEntity> getAllWithFeignClientWithTimeCondiction() throws Exception {
    final String methodName = "getAllWithFeignClientWithCondiction()";
    try {
        this.startLog(methodName);

    List<M_MEntity> result = new ArrayList<M_MEntity>();
    String token = getToken();
    result = feignClient.getAllDataFromInfluxDBwithTimeCondiction(token);
    logger.info("Request Successful");

    if (!result.isEmpty()) {
        for (M_MEntity m_MEntity: result) {

            M_MEntityPstgrs m_MEntityPstgrs = new M_MEntityPstgrs();

            m_MEntityPstgrs = ConvertersUtils
                    .createM_MEntityPstgrs FromM_MEntity(
                            m_MEntity);

            mMDao.save(m_MEntityPstgrs);
            logger.info("Table Updated");
        }
    }
    this.endLog(methodName,result);
    return result;
} catch (final Exception e) {
    logger.error(e.getMessage());
    this.errorLog(methodName,e);
    throw e;
}

}

但是当我尝试从我的服务类中执行这些 get 方法之一时,我得到了这个异常:

feign.codec.DecodeException: Error while extracting response for type [java.util.List<com.simplemicroservice.database.influx.entity.M_MEntity>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.util.ArrayList<com.nttdata.iot.simplemicroservice.database.influx.entity.M_MEntity>` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList<com.nttdata.iot.simplemicroservice.database.influx.entity.M_MEntity>` out of START_OBJECT token

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...