• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TransactionalEventListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.transaction.event.TransactionalEventListener的典型用法代码示例。如果您正苦于以下问题:Java TransactionalEventListener类的具体用法?Java TransactionalEventListener怎么用?Java TransactionalEventListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TransactionalEventListener类属于org.springframework.transaction.event包,在下文中一共展示了TransactionalEventListener类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doWith

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {

	if (methodFound) {
		return;
	}

	TransactionalEventListener listener = AnnotatedElementUtils.findMergedAnnotation(method,
			TransactionalEventListener.class);

	if (listener == null) {
		return;
	}

	this.methodFound = true;

	bean = createCompletionRegisteringProxy(bean);
}
 
开发者ID:olivergierke,项目名称:spring-domain-events,代码行数:19,代码来源:CompletionRegisteringBeanPostProcessor.java


示例2: saveClaim

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void saveClaim(ClaimIssuedEvent event) {
    try {
        coreCaseDataService.save(event.getAuthorisation(), event.getClaim());
    } catch (CoreCaseDataStoreException ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
开发者ID:hmcts,项目名称:cmc-claim-store,代码行数:9,代码来源:CoreCaseDataUploader.java


示例3: isTransactionalApplicationEventListener

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
private static boolean isTransactionalApplicationEventListener(ApplicationListener<?> listener) {

		Class<?> targetClass = AopUtils.getTargetClass(listener);

		if (!ApplicationListenerMethodAdapter.class.isAssignableFrom(targetClass)) {
			return false;
		}

		Field field = ReflectionUtils.findField(ApplicationListenerMethodAdapter.class, "method");
		ReflectionUtils.makeAccessible(field);
		Method method = (Method) ReflectionUtils.getField(field, listener);

		return AnnotatedElementUtils.hasAnnotation(method, TransactionalEventListener.class);
	}
 
开发者ID:olivergierke,项目名称:spring-domain-events,代码行数:15,代码来源:PersistentApplicationEventMulticaster.java


示例4: on

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@Async
@TransactionalEventListener
void on(OrderCompleted event) {

	log.info("Sending email for order {}.", event.getOrder());

	try {
		Thread.sleep(1000);
	} catch (InterruptedException o_O) {}

	log.info("Successfully sent email for order {}.", event.getOrder());
}
 
开发者ID:olivergierke,项目名称:sos,代码行数:13,代码来源:EmailSender.java


示例5: after

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void after(final AnyDeletedEvent event) {
    LOG.debug("About to delete index for {}[{}]", event.getAnyTypeKind(), event.getAnyKey());

    DeleteResponse response = client.prepareDelete(
            AuthContextUtils.getDomain().toLowerCase(),
            event.getAnyTypeKind().name(),
            event.getAnyKey()).
            get();

    LOG.debug("Index successfully deleted for {}[{}]: {}",
            event.getAnyTypeKind(), event.getAnyKey(), response);
}
 
开发者ID:apache,项目名称:syncope,代码行数:14,代码来源:ElasticsearchIndexManager.java


示例6: handle

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void handle(PayloadApplicationEvent<TestModel> event) {
	System.err.println(event.getPayload().getName());
	//这里可以记录日志, 发送消息等操作.
	//这里抛出异常, 会导致addTestModel方法异常, 但不会回滚事务.
	//注意, ApplicationEventPublisher不能使用线程池, 否则不会执行到这里
	//因为, 包装类是通过ThreadLocal来判断当前是否有活动的事务信息.
	//TransactionalEventListener.fallbackExecution就是为了决定当当前线程没有事务上下文时, 
	//是否还调用 handle 方法, 默认不调用.
}
 
开发者ID:haogrgr,项目名称:haogrgr-test,代码行数:11,代码来源:TransactionEventListener.java


示例7: on

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void on(DomainEvent event) {}
 
开发者ID:olivergierke,项目名称:spring-domain-events,代码行数:3,代码来源:PersistentDomainEventIntegrationTest.java


示例8: handleUserEmailChanged

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@Async
@TransactionalEventListener
public UserEmailChangedEvent handleUserEmailChanged(UserEmailChangedEvent emailChangedEvent) {
  System.out.println("UserEmailChangedEvent:" + emailChangedEvent.getSource());
  return null;
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:7,代码来源:UserDomainService.java


示例9: doSomething

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT)
public void doSomething(TransactionNotifyEvent transactionNotifyEvent) {
    System.out.println("提交之前" + transactionNotifyEvent.getUserName());
}
 
开发者ID:Qunzer,项目名称:learningJava,代码行数:5,代码来源:TransactionEventClassListener.java


示例10: doSomething2

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void doSomething2(TransactionNotifyEvent transactionNotifyEvent) {
    System.out.println("提交之后" + transactionNotifyEvent.getUserName());
}
 
开发者ID:Qunzer,项目名称:learningJava,代码行数:5,代码来源:TransactionEventClassListener.java


示例11: doSomething3

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT, fallbackExecution = true)
public void doSomething3(TransactionNotifyEvent transactionNotifyEvent) {
    System.out.println("提交完成" + transactionNotifyEvent.getUserName());
}
 
开发者ID:Qunzer,项目名称:learningJava,代码行数:5,代码来源:TransactionEventClassListener.java


示例12: afterCommit

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void afterCommit(TransactionalEvent transactionalEvent){
    allEvents.add(transactionalEvent);
}
 
开发者ID:victorbuckservices,项目名称:workshop-spring-4.0-to-4.2,代码行数:5,代码来源:TransactionEventListener.java


示例13: beforeCommit

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT)
public void beforeCommit(TransactionalEvent transactionalEvent){
    allEvents.add(transactionalEvent);
}
 
开发者ID:victorbuckservices,项目名称:workshop-spring-4.0-to-4.2,代码行数:5,代码来源:TransactionEventListener.java


示例14: handleSaleEvent

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void handleSaleEvent(SaleCreatedEvent event) {
	handleSaleModificationEvent(event);
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:5,代码来源:SaleModificationListener.java


示例15: handleSaleDeleted

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void handleSaleDeleted(SaleDeletedEvent event) {
	this.template.convertAndSend("/topic/deletedSale", event.getSale().getId());
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:5,代码来源:SaleDeletedListener.java


示例16: handleAfterTxCommitTask

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener()
public void handleAfterTxCommitTask(AfterTxCommitTask task) {
    task.run();
}
 
开发者ID:grassrootza,项目名称:grassroot-platform,代码行数:5,代码来源:TransactionalEventsHandler.java


示例17: blogAddedTransactional

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener
public void blogAddedTransactional(BlogAddedEvent blogAddedEvent) {
    log.info("Transactional sending external notification for added blog: {}", blogAddedEvent.getBlog());
    notificationSender.blogAddedTransactional(blogAddedEvent);
}
 
开发者ID:szpak,项目名称:code-examples-and-poc,代码行数:6,代码来源:BlogEventListener.java


示例18: blogAddedTransactionalWithFallback

import org.springframework.transaction.event.TransactionalEventListener; //导入依赖的package包/类
@TransactionalEventListener(fallbackExecution = true)
public void blogAddedTransactionalWithFallback(BlogAddedEvent blogAddedEvent) {
    log.info("Transactional (with fallback) sending external notification for added blog: {}", blogAddedEvent.getBlog());
    notificationSender.blogAddedTransactionalWithFallback(blogAddedEvent);
}
 
开发者ID:szpak,项目名称:code-examples-and-poc,代码行数:6,代码来源:BlogEventListener.java



注:本文中的org.springframework.transaction.event.TransactionalEventListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TasksInfo类代码示例发布时间:2022-05-22
下一篇:
Java CoordinateArrays类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap