I have developed a REST server with our app specific APIs. we also have deployed a different rest Job server into another location. Currently the way I am doing is .
@RestController
public class SparkJobController {
@Autowired
private IJobSchedulerService jobService;
...
And the Service Implementation is
@Service(value="jobService")
public class JobSchedulerServiceImpl implements IJobSchedulerService {
@Override
public Map triggerJob(String context) {
Map<String, ?> s = new HashMap<String,Object>();
RestTemplate restTemplate = new RestTemplate();
// restTemplate call to other REST API. and returns Map.
...
}
My question is , Is my approach correct ? Or Does Spring framework enables us to use some predefined APIs which can help to use RESTTemplate as a Service
[EDIT] : the deployed REST service is third party application.