티스토리 뷰

spring

트랜잭션 설정

paulownia 2018. 9. 26. 18:28

root-context.xml


<!--

...484p.

...스프링에서 트랜잭션을 처리하는 방식은 

   1. XML을 사용해서 별도의 transaction-context.xml을 이용하는 방식. 

   2. DAO 또는 Mapper등을 이용하는 xxxService클래스에 어노테이션으로 처리하는 방식이 있음.

   

...489p.

...스프링 프로젝트를 이용해서 생성된 경우 가장 간단한 설정은 DataSource설정이

   존재하는 곳에 적용하는 것이 가장 편리함.

   하나의 DataSource를 사용하는 경우, 스프링에서 제공하는 DataSourceTransactionManager를

   이용하고, 이때 필요한 DataSource를 주입받음.

-->

<bean id="transactionManager" 

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

<property name="dataSource" ref="dataSource"></property>

</bean>

<!-- 

...489p. 

   @Transactional을 이용한 트랜잭션 관리가 가능함.

   일반적인 @Transactional 설정방법 :

클래스 또는 인터페이스에는 공통적인 규칙을 선언함.

메서드에는 특별한 설정을 추가함.

    ...500p.

       @Transactional 의 우선순위 : 메서드 > 클래스 > 인터페이스.      

-->

<tx:annotation-driven/>

'spring' 카테고리의 다른 글

AOP(Aspect Oriented Programming) 용어  (0) 2018.09.27
@Transactional 애노테이션 속성  (0) 2018.09.27
AOP, root-context 설정  (0) 2018.09.20
AOP 라이브러리, pom.xml  (0) 2018.09.20
pom.xml  (0) 2018.09.01
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함