ошибка отправки POST через RestTemplate

отправляю запрос на 8080, получаю ошибки введите сюда описание изображения

package jdev.services;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;


@Service
public class DataSendService{
    private static final Logger log = LoggerFactory.getLogger(DataPeekService.class);

    Object DataGps;

    @Autowired
    private DataPeekService dataPeekService;

    @Autowired
    public Coordinats coordinats;

//    @Autowired
//    public RestTemplate restTemplate;

    RestTemplate restTemplate = new RestTemplate();
    private int latitude;

    @Scheduled(fixedDelay = 2_000)
    void take() throws InterruptedException {
        System.out.println( "Данные :" );
//        log.info("  Координаты = " + dataPeekService.getCoor());
        DataGps = dataPeekService.getCoor();
        System.out.println( DataGps );

        // вот здесь создать RestTemplate и выполнить отправку
        restTemplate.postForObject("http://localhost:8080/DataGps", DataGps,Object.class);
    }

}

класс сервера

package jdev.services;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Егор on 25.11.2017.
 */
@RestController
public class Controller {
    Logger logger = LoggerFactory.getLogger(Controller.class);
    private long previous;

    @Autowired
    FileService FileService;

//    @Autowired
//    DataSendService dataSendService;


    @RequestMapping(value = "DataGps",method = RequestMethod.POST)
    public @ResponseBody
    FileService DataGps (@RequestBody FileService DataGps) { // выглядит нормально, надо только правильно прописать ComponentScan чтобы этот контроллер инициализировался
        // прием выглядит нормально, должен принмиать, можно проверить утилитой curl, но можно и не проверять, а сразу из трекера кидать, или смотрите видео :)
        long current = System.currentTimeMillis();
        logger.info((current - previous) + " lon = " + DataGps.longitude + " lat = " + DataGps.latitude() + "azimuth" + DataGps.azimuth + "speed" + DataGps.azimuth);
//        FileService.writeInFile((current - previous) +"AutoId" + DataGps.getAutoId() + " lon = " + DataGps.getLon() + " lat = " + DataGps.getLat());
        return DataGps;
    }


    //можно добавить метод с аннотацией PostConstruct и в нем вывод в лог, чтобы проверить что данный контроллер инициализируется спрингом
}

Буду признателен за любую помощь. Спасибо.


Ответы (0 шт):