jta with spring in web application - spring

If I follow spring and bitronix instructions and I run web application on tomcat, do I still need to configure:
in web.xml the resource-ref
in context.xml the resrouce and transaction tag
in web.xml the bitronix.tm.integration.tomcat55.BTMLifecycleListener
in resource.properies the Data resource?
I prefer to configure the bitronix (btm) only in spring and not in tomcat. is it possible in web application?

Transactions ought to be associated with the service tier, which does not depend at all on the web tier. (The web tier, however, does use the service tier to fulfill requests.)
If that's the case, there shouldn't be a reason to embed information about transactions in any configuration except Spring's.

Related

tomcat webserver/servlet container/dispatcher servlet interaction in springboot

what is the flow diagram of interactions between tomcat web server/servlet container and dispatcher servlet . tomcat servlet container is separate from spring IOC container or applicationcontext ?
Tomcat is a web server. It "knows" how to deal with web applications according to the web applications specification.
This specification defines means of servlets declaration, their order, etc. It also defines additional notions like filters, listeners, etc. This specification has nothing to do with spring. Basically, you can use tomcat to host the application with servlets, filters, listeners without spring dependencies, so you won't even have an application context.
With this in mind, Spring MVC (to which the Dispatcher Servlet actually belongs) is just a third-party among many others from the Tomcat standpoint.
DispatcherServlet is an ordinary servlet that the spring team has developed. It is an entry point to all spring infrastructure in web applications managed by a web server, it's a "glue" that acts as a "driver" - it loads the application context (all the beans), handles all the requests coming to the controllers, etc.

Can spring boot applications deployed on a tomcat server use a common connection pooling?

When multiple spring boot applications created and deployed to a tomcat server. Is it possible to use a common connection pooling, datasource instead of providing these details in application.properties file. Or does this already taken care within the spring boot implementation
When you deploy multiple application then each application manages it connection pool.
Spring boot boundary is limited to each application context and it does not know what other application deployed and which db they are using.

spring boot without web server but with management server

we have many services developed with spring boot, some are web services with a servlet container and some are services without a servlet container.
we don't use #EnableAutoConfiguration but we add only the auto configurations we need because our classpath is a mess and full auto configuration may create many beans we don't really need.
on services that don't need a servlet container we still want to have actuator and management server, so we register EndpointWebMvcAutoConfiguration but it has a condition on web application and does not create the management server.
of course i could just add EmbeddedServletContainerAutoConfiguration and just have a servlet container that does nothing but i don't like to do that.
Any idea how to cause spring boot to create the management server even on non web environment?
Thank you

Spring Remote, configure httpinvoker and JAX on the same server

I have a server running on tomcat exposing Spring services using HttpInvoker.
I have exposed the methods of 5 services using HTTPInvoker.
This works very well.
The spring configuration is described in a file named remoting-servlet.xml; and the remoting servlet (DispatcherServlet) is described in the web.xml.
I now have an additional need to expose one additional service using JAX-WS this time (I will have C# clients).
I will use Spring support to JAX-WS.
I have the option to use the default deployment, or to use JAX-WS RI's to deploy this additional service to the same server as the remoting servlet.
I would prefer this last solution, because I would have only one server providing the remote services (whether they are web services or httpinvokers).
My question is: is this possible?
I think that I can I put the 2 servlets on the same port. But my issue is that it seems to me that I will have to provide 2 different application contexts. One for the DispatcherServlet, and one for the WSSpringServlet.
Is that correct?
Is it possible to put the WSSpringServlet context definition to the same file as the one for the httpinvokers (remoting-servlet.xml)?
Many thanks
Gilles

With Spring do you still need a java application server and when?

looks to me you need tomcat or some other servlet engine for the web part.
what about data access part using hibernate and jms? Thanks.
No, you don't need an application server, you can see Spring as a proprietary, modular application server implementation / adapter. But you still need an a servlet container.
Data access part: you can use hibernate and some standalone connection pool
jms: Spring is not a JMS provider, but it nicely integrates POJOs with any JMS provider
Spring also has comprehensive transactions support
Finally you have jmx and aop support built-in and easy integration with bean validation, jpa, web services, rmi, jci, task scheduling, caching...
As you can see you can either use certified application server and Java EE stack or built on top of Tomcat and pick Spring modules you need. Sometimes Spring uses standard Java EE APIs (like JPA), more often it builts its own.

Resources