• 导致spring事务配置不起作用的一种原因


    @Component
    public class AnalyticsApplication {
    
        @Autowired
        private InitializationActionService initializationActionService;
    
        @PostConstruct
        @Transactional("transactionManager") // in here, the transaction configuration does not work
        public void systemInitialize() {
            initializationActionService.systemInitialize();
        }
    
    }
    
    -----------------------------------------------------------------------------
    
    @Component
    public class InitializationActionService {
    
        public void systemInitialize() {
              // TODO: do something
        }
    
    }
    @Component
    public class AnalyticsApplication {
    
        @Autowired
        private InitializationActionService initializationActionService;
    
        @PostConstruct
        public void systemInitialize() {
            initializationActionService.systemInitialize();
        }
    
    }
    
    -----------------------------------------------------------------------------
    
    @Component
    public class InitializationActionService {
    
        @Transactional("transactionManager") // in here, The transaction configuration works
        public void systemInitialize() {
              // TODO: do something
        }
    
    }
  • 相关阅读:
    ls命令设计思想
    Collection框架
    Yosemite 的问题
    mac vim的alt键无法正常映射
    Word Ladder
    vim自动补全
    Clone Graph
    C# 关于接口与基类的理解(二者的区别)
    C# 操作Excel基础篇(读取Excel、写入Excel)
    C# 随机数 Radom 循环生成同一的数字
  • 原文地址:https://www.cnblogs.com/bgo-tech/p/6819128.html
Copyright © 2020-2023  润新知