I am creating an application that has a standalone "core" level, which is also used to create webapp (this is a multi-module Maven project with the "core" module and the "webapp" module, which has a dependency on the "core" module). It uses a MySQL database. I am trying to implement DataSourcewhat would be good in both contexts (just one connection in an autonomous context is enough).
After reading many docs about DataSources, I have to say that I'm a little lost. I concluded that maybe I should use the Tomcat JDBC Connection Pool . My questions:
1) in a stand-alone context, how should I provide a configuration for using a DataSource, knowing that this configuration will be provided by Tomcat in the webapp context (a stand-alone configuration should not, therefore, override Tomcat's configuration)?
Should I do something like this in this other question in a method that is called only in an autonomous context? But how can I see in the context of the webapp that Tomcat has already provided a DataSource?
Or Should I use a bean definition? But how will this bean not be used in a webapp context?
2) What about other federated DataSource implementations?
:
, , , " " DataSource. .