restcontroller
-
[RESTFUL 학습] JPA를 이용한 CRUD 기본 예제 (RESTCONTROLLER)SPRING/WEBSERVICE 2020. 9. 6. 17:12
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface UserRepository extends JpaRepository { } Repository 인터페이스의 메서드를 이용하여 Entity를 참조하거나 수정/추가 할 수 있다. RESTCONTROLLER 에서는 아래와 같이 CRUD를 사용하면 된다. @RestController @RequestMapping("/jpa") public class UserJpaController { @Autowired private UserRepository userReposito..