I use Spring Data Rest and I can not understand why my RepositoryRestController does not work. Its code:
@RepositoryRestController public class Cntrl { @Autowired private UserDao userDao; @RequestMapping(name = "/users/{id}/nameOne",method = RequestMethod.GET) @ResponseBody public PersistentEntityResource setNameOne(@PathVariable("id") Long id, PersistentEntityResourceAssembler persistentEntityResourceAssembler){ User user = userDao.findById(id).orElseThrow(()->{ throw new ServerException("Wrong id"); }); user.setLogin("One"); userDao.save(user); return persistentEntityResourceAssembler.toFullResource(user); } } And Spring Boot start class:
@SpringBootApplication @EnableWebMvc @EnableScheduling @EnableJpaRepositories @EnableSpringDataWebSupport public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } When i go to base path (localhost:8080/api) everything is fine, but when send GET to request to localhost:8080/api/users/1/nameOne I get empty response, i dont have other controllers and I have user with id 1, so why it is not working ?