Last active
December 28, 2015 09:29
-
-
Save yanhua365/7479711 to your computer and use it in GitHub Desktop.
返回XML响应的Spring Boot CLI脚本。
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
package org.test | |
@Grab("spring-boot-starter-actuator") | |
@RestController | |
public class XmlResponseController { | |
@RequestMapping(value="/xml", method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) | |
public def hello() { | |
//实际应用的时候可以用MarkupBuilder来构造 | |
'''<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<book> | |
<name>java in action.</name> | |
</book> | |
'''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment