Resource HateOAS
์ ๋ ์คํ๋ง๋ถํธ 2.4.12๋ฅผ ์ฌ์ฉํ๊ณ ์๊ณ , ์ฒ์์ Hateos ๊ด๋ จ ํด๋์ค๋ฅผ ๋ถ๋ฌ์ฌ ๋ ์์ฑ์๋๊ณผ ๋์ผํ๊ฒ ๊ณ ๋ฏผํ์ด์ ๋์์ด ๋์๊ธธ ๋ฐ๋์ ๊ฐ์ฌ๋์ ์๋์ง๋ง, ๋๊ธ ๋จ๊น๋๋ค. Hateoas๋ ๋ฒ์ ์ ๋ฐ๋ผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ด ๋ค๋ฅด๋ค๊ณ ์๊ณ ์์ต๋๋ค. ์ ์ฝ๋์
๋๋ค. @GetMapping("/users/{id}") public EntityModel retrieveUser(@PathVariable int id){ Optional user = userRepository.findById(id); if(!user.isPresent()) { throw new UserNotFoundException(String.format("ID[%S] not found", id)); } EntityModel userModel = new EntityModel(user.get()); WebMvcLinkBuilder linkTo = linkTo(methodOn(this.getClass()).retrieveAllUsers()); userModel.add(linkTo.withRel("all-users")); return userModel; } ์ ๊ฐ ์์ฑํ ๋ ์ฐธ๊ณ ํ ์ฌ์ดํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. https://jeonghoon.netlify.app/Spring/SpringBoot13-hateoas/ ํด๊ฒฐ์ด ์๋์
จ๋ค๋ฉด ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์์!