Transaction management in spring (summary)

Transaction management in spring (summary)


The relationship between the SpringIOC container and the SpringMPCIOC container

Beans in SpringMVC's IOC container can reference beans in Spring IOC container.

What about the return? Not vice versa. The bean in the Spring IOC container cannot refer to the bean in the SpringMVC IOC container 

l Reference the Bean of the business layer in the Spring MVC configuration file

l A parent-child relationship can be set between multiple Spring IOC containers to achieve good decoupling.

l Spring MVC WEB layer container can be used as a sub-container of "business layer" Spring container:

That is, the WEB layer container can refer to the beans of the business layer container, but the business layer container cannot access the beans of the WEB layer container.

 

 

3. Configuration of cxf transactions

In a Spring project, when using @WebService to call the interface remotely, you cannot add a transaction to @WebService

 

In WebService's own project, you can use Spring's DataSourceTransactionManage transaction manager. The configuration method is similar to the method of configuring transactions in Spring and SpringMVC. You can also add a business layer to cxf and write the configuration information in the spring configuration file.

 

 

 

Summarize:

Generally speaking, when adding a transaction, the class and interface are managed by the container of the configured transaction, and the method of the class and interface can be added to the transaction within the scope of its pointcut expression.

 

The relationship between multiple data source switching and transaction management aop

When multiple data source switching encounters a transaction,

If the data source is switched in the business layer, it is equivalent to injecting the business of the agent when the business layer is injected into the control layer, and the data source of the business layer of the agent has been specified in the DataSourceTransactionManager

When the code is executed to the business layer, the proxy is executed, and it is invalid to switch the data source in the proxy class

 



 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325939637&siteId=291194637