Skip to content

Instantly share code, notes, and snippets.

@jbrackett
Created February 10, 2014 02:22
Show Gist options
  • Save jbrackett/8909321 to your computer and use it in GitHub Desktop.
Save jbrackett/8909321 to your computer and use it in GitHub Desktop.
HelloWorldSpring4Controller
package com.hello.controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/hello")
public class HelloController {
@RequestMapping(method = RequestMethod.GET, value = "/{name}")
public String sayHello(@PathVariable("name") String name) {
return name + " from the server";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment