0
私は春3.0.5を使用し、休止状態です。バネの問題。コミット後にインターセプタが呼び出される方法を教えてください。
- インターセプタが動作しています。
- jmsキューにドメインIDを送信します。
- コンシューマーはそれを受け取り、ドメインを検索しますが、データベースのコミットよりも高速で、nullを返します。
db commit後にインターセプタを呼び出す方法を教えてください。
appCtx.xml
<tx:annotation-driven order="10" /> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <aop:aspectj-autoproxy /> <bean id="domainProducerHandler" depends-on="domainEventService" class="org.test.service.DomainProducerHandler" factory-method="aspectOf"> <property name="domainEventService" ref="domainEventService" /> <property name="order" value="1" /> </bean> ===================service class===================== @SendDomainEvent @Transactional public ProtoMessage sendDonation(String aa) { Domain domainObj = new Domain(); domainRepository.saveAndFlush(domainObj); return domain; } ==================interceptor class===================** @AfterReturning( pointcut="@annotation(org.test.service.SendDomainEvent)", returning="retVal") public void processDomainReturn(Object retVal) { .... try { domainEventService.publishToQueue(endDonationSuccessEvent); } catch (Exception e) { log.error("error during send endDonationSuccessEvent: " + e); }
}
インターセプタクラスが実装するインターフェイスを命じました。注文パラメータをtxに設定しました。注釈主導の注文= "10"ですが、動作しません。
@orderアノテーションがあります。 – iddqd