search

Home  >  Q&A  >  body text

java - service中开启线程的事务问题

现在的情况是在AService(spring创建)中 开启了一个线程,该线程通过线程池(spring创建)执行execute,线程中执行了BService(spring创建)的逻辑 事务都配成required,方法知道下来会在一个事务里么?

PHPzPHPz2926 days ago486

reply all(2)I'll reply

  • 阿神

    阿神2017-04-18 09:58:07

    PROPAGATION_REQUIRED
    If there is no current transaction, create a new transaction. If there is already a transaction, add it to this transaction.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:58:07

    I remember that Spring’s transactions are implemented through ThreadLocal, so AService and BService will not be in the same transaction

    reply
    0
  • Cancelreply