Skip to content

Instantly share code, notes, and snippets.

@lsantos
Created July 24, 2013 19:10
Show Gist options
  • Save lsantos/6073523 to your computer and use it in GitHub Desktop.
Save lsantos/6073523 to your computer and use it in GitHub Desktop.
Spring rest controller
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.santos.leandro.spring.mvc.models.Season;
import com.santos.leandro.spring.services.SeasonService;
@Controller
@RequestMapping(value="/seasons")
public class SeasonController {
@Autowired private SeasonService seasonService;
public SeasonController() {
}
@RequestMapping(value="all", method=RequestMethod.GET)
public @ResponseBody List<Season> getAll() {
return this.seasonService.getAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment