Created by qianlong on 16/7/20.
*/
@RestController
public class UserController {
@RequestMapping(value = "/users/{username}",method=RequestMethod.GET,consumes="application/json")
public String getUser(@PathVariable String username, @RequestParam String pwd){
return "Welcome,"+username;
}
}
可以参考使用Spring Boot开发Restful程序
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.*; /**