Skip to content

Instantly share code, notes, and snippets.

@ajaykumarns
Created June 24, 2012 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajaykumarns/2981121 to your computer and use it in GitHub Desktop.
Save ajaykumarns/2981121 to your computer and use it in GitHub Desktop.
Retrieve Product by id
package com.anadathur.springapp1;
import org.springframework.web.client.RestTemplate;
import com.anadathur.springapp1.model.Product;
public class ProductById{
public static void main(String [] args){
RestTemplate template = new RestTemplate();
Product product = template.getForObject("http://kick-ass-product/api/product/{id}", Product.class, 123);
System.out.println("Product retrieved: " + product);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment