Created
June 24, 2012 02:39
-
-
Save ajaykumarns/2981155 to your computer and use it in GitHub Desktop.
Create new product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.anadathur.springapp1.example; | |
import org.springframework.web.client.RestTemplate; | |
import com.anadathur.springapp1.model.Product; | |
public class CreateNewProduct{ | |
public static void main(String [] args){ | |
RestTemplate template = new RestTemplate(); | |
Product p = new Product(); | |
p.setName("Apple"); | |
p.setPrice(1.2f); | |
p.setQuantity(100); | |
Product product = template.postForObject("http://kick-ass-product/api/product/", p, Product.class); | |
System.out.println("Created new product: " + product); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment