목록동일 클래스에서 @Transactional (1)
Arthur's Blog

아래 글에서 "실제 서비스"는 개발자가 직접 작성한 서비스의 코드이고, "Proxy객체"는 Spring이 CGLIB 또는 JDK Proxy를 통해 실제 서비스를 감싼 객체이다. Service를 작성하게 되면 실행될 때 Proxy객체가 만들어지며 DI받은 Bean의 method를 실행시키면 Proxy객체를 통해서 실제 Service가 호출된다. public class ProxyUserService { private final UserService userService; private final EntityManager em; public void doTransaction() { EntityTransaction tx = em.getTransaction() try { tx.begin(); userService..
Backend/Spring Boot
2023. 8. 10. 00:06