In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "what are the seven communication behaviors of Spring affairs?". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. what is transaction communication behavior?
What is transaction propagation behavior? It sounds high-end, but it's actually very simple.
Even if it is communication, then there are at least two things that can spread. There is no such behavior as transmission in monomers.
The transaction propagation behavior is how the transaction is passed when the methods of multiple declared transactions are called to each other.
Such as the figure above: methodA () calls methodB (), then both methods show that the transaction is opened, so methodB () starts a new transaction, or continues to execute in the transaction methodA (), to determine a behavior of the so-called transaction propagation.
Second, what are the communication behaviors of affairs?
Seven transaction propagation behaviors are defined in Spring. The full version of the propagation behavior is as follows:
REQUIRED (default): it is the default transaction propagation behavior in Spring, which adds the new existing transaction to the current transaction and creates a transaction if it does not exist.
REQUIRE_NEW: no matter whether there is a transaction or not, it will open a new transaction to execute. The new and old transactions are independent of each other, and the external transaction throws an exception, which will not affect a normal commit of the internal transaction.
NESTED: if there is a transaction, it is nested in the current transaction to execute. If there is no transaction, then create a new transaction, such as REQUIRE_NEW, a propagation behavior.
SUPPORTS: indicates that the current transaction is supported. If no transaction exists, it will be executed in a non-transactional manner.
NOT_SUPPORT: means to run in a non-transactional manner, and if there is a current transaction, you need to suspend the current transaction.
MANDATORY: it is a mandatory transaction execution that throws an exception if no transaction currently exists
NEVER: it is executed in a non-transactional manner, and an exception is thrown if there is a transaction
The transaction propagation level of Spring generally does not need to be defined, and the default is REQUIRED, unless in the case of nested transactions, you need to focus on understanding
This is the end of the content of "what are the seven communication behaviors of Spring transactions". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.