Created
May 9, 2015 04:05
-
-
Save limingzju/28379ab4d5ed3be90954 to your computer and use it in GitHub Desktop.
spring path variable
This file contains 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
@RequestMapping( | |
value = "/{id}.json", | |
method = RequestMethod.GET, | |
produces = "application/json") | |
@ResponseBody | |
public Person getDetailsAsJson(@PathVariable Long id) { | |
return personRepo.findOne(id); | |
} | |
@RequestMapping( | |
value = "/{id}.xml", | |
method = RequestMethod.GET, | |
produces = "application/xml") | |
@ResponseBody | |
public Person getDetailsAsXml(@PathVariable Long id) { | |
return personRepo.findOne(id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment