package com.springapp.mvc.controller;
import com.springapp.mvc.entities.User;
import com.springapp.mvc.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by Marcin on 29.02.2016.
*/
@RestController
public class UserRest {
@Autowired
private UserService userService;
@RequestMapping(value = "/rest/users/", method = RequestMethod.GET)
public ResponseEntity<List<User>> getAllUsers(){
List<User> users = userService.findAll();
return new ResponseEntity<List<User>>(HttpStatus.OK);//You many decide to return HttpStatus.NOT_FOUND
}
//RestTemplate restTemplate = new RestTemplate();
//Kot kot = restTemplate.getForObject("http://localhost:8080/api/koty/1", Kot.class);
}
WARN PageNotFound:1120 - No mapping found for HTTP request with URI [/rest/users] in DispatcherServlet with name 'DispatcherServlet'
type Status report
message
description The requested resource is not available.
Inne kontrolery i adresy działają, tylko nie są restami