简体   繁体   English

在Tomcat中部署spring时是否需要JTA TX管理器

[英]Does spring requires JTA TX manager when deployed in Tomcat

I have a web application, deployed in Tomcat. 我有一个Web应用程序,部署在Tomcat中。 This app depends on one Spring pojo app jar, whcih is available in the classpath. 此应用程序依赖于一个Spring pojo应用程序jar,在类路径中可用。

Spring POJO app, contains some DAO's and few services, I'm accessing these DAO's and services in web app as beans, by loading the spring context using ClassPathXMLApplicationContext. Spring POJO应用程序包含一些DAO和少量服务,我通过使用ClassPathXMLApplicationContext加载spring上下文,以bean的形式访问Web应用程序中的这些DAO和服务。

The Serivces in Spring app also uses the DAOs , in which case both the apps accessing the same DB. Spring中的Serivces应用程序还使用DAO,在这种情况下,两个应用程序都访问同一数据库。 Spring POJO app uses HibernateTransactionManager. Spring POJO应用程序使用HibernateTransactionManager。

For this scenario, HibernateTXManager is good, or Do I need to gor JTA? 对于这种情况,HibernateTXManager很好,还是我需要对JTA进行gor处理?

JTA is useful when you want to enlist two or more Datasources in the sam global transaction. 当您要在sam全局事务中加入两个或多个数据源时, JTA很有用。

In your case you should have Services use DAOs and Web beans use Services , so this is just a Spring application design decision. 在您的情况下,应该让Services使用DAOs ,Web Bean使用Services ,所以这只是Spring应用程序设计的决定。

For connection pooling, I advice you take a look on HikariCP , which is probably the fastest one on the market . 对于连接池,建议您使用HikariCP ,它可能是市场上最快的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM