TAILIEUCHUNG - Building Spring 2 Enterprise Applications phần 7

Trong phần này, chúng tôi sẽ bao gồm những hình thức phân giới cắm mốc giao dịch là một phần của việc phát hành mùa xuân 1,0. Sau đó phát hành mùa xuân thêm các hình thức khác, đáng chú ý nhất là mùa xuân 2,0. Tuy nhiên, phát triển toàn diện mùa xuân nên được nhận thức của các hình thức cũ, | 196 CHAPTER 7 TRANSACTION MANAGEMENT Transaction Demarcation Introduced in Spring In this section we ll cover those forms of transaction demarcation that were part of the Spring release. Later Spring releases added other forms most notably Spring . However all-round Spring developers should be aware of these older forms as they have been in common use for many years. Also other transaction-demarcation mechanisms reuse the components that are introduced here. Transactioninterceptor and Proxy Creation The core AOP component in all forms of transaction demarcation is the . class. It s an around advice that implements the Methodinterceptor interface see Chapter 3 . Transactioninterceptor is a thread-safe class that starts a transaction before a method is executed and ends it after the method execution exits. Listing 7-3 shows the configuration of Transactioninterceptor in a Spring XML file. Listing 7-3. Configuring Transactioninterceptor beans bean id dataSource class destroy-method close property name driverClassName value property name url value property name username value property name password value bean bean class . PropertyPlaceholderConfigurer property name location value classpath bean bean id transactionManager class . DataSourceTransactionManager property name dataSource ref dataSource bean bean id transactionInterceptor class property name transactionManager ref transactionManager property name transactionAttributes props prop key endMatch PROPAGATION_REQUIRED prop props property bean beans The transactioninterceptor bean in Listing 7-3 is an around advice configured to use the DataSourceTransactionManager. The other property .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.