I have a Spring Boot application that connects to two separate databases. All works fine (I followed the steps in [the docs](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-data-access.html#howto-two-datasources) and [a tutorial](https://medium.com/@joeclever/using-multiple-datasources-with-spring-boot-and-spring-data-6430b00c02e7)), although in order to customize the Tomcat JDBC connection pool settings, [I had to manually configure it](https://stackoverflow.com/a/42712947/2261315) (because by defining multiple data sources, the Boot auto-configuration is ignored, and Spring Boot does not read the tomcat-specific properties anymore from application.properties).

When I use a debugger during the configuration of the two DataSources, I see that both [org.apache.tomcat.jdbc.pool.DataSource](https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/DataSource.html) instances have the same connection pool in the DataSource.PoolProperties["name"] entry.
See below screenshots in the debugger, each dataSource() method is configured in a separate configuration class. Notice that the same Connection Pool is defined.
[![Primary DataSource CP configuration](https://i.stack.imgur.com/Tz8kf.png)](https://i.stack.imgur.com/Tz8kf.png)
[![Secondary DataSource CP configuration](https://i.stack.imgur.com/Uqxjl.png)](https://i.stack.imgur.com/Uqxjl.png)

However, from what I see using jConsole + tomcat JMX, there is only one connection pool, which has the primary database details configured (URL, credentials, see below).
[![jConsole inspecting the Tomcat JDBC JMX info about the Connection Pool](https://i.stack.imgur.com/a6vz8.png)](https://i.stack.imgur.com/a6vz8.png)

Because of the multiple layers of abstraction inside Spring, it is difficult for me to debug this. I have the [Eclipse Class Decompiler plugin](https://marketplace.eclipse.org/content/eclipse-class-decompiler), which I normally use to see the Spring logic, but in this case, the initialization code for the data sources happens when the beans are registered, not when they are actually used by Spring Boot to set the data sources up.

Bottom line, can you help me understand:

1. why there is only one connection pool
2. how can I use two connection pools, one for each data source
3. where in the Spring code to look at for more details of how this works

For the 2nd question, there is a somewhat [related question](https://stackoverflow.com/questions/37163160/spring-boot-connection-pool-autoconfiguration-for-more-than-one-datasource), but with no answer. There is [another question](https://stackoverflow.com/questions/43529778/multiple-db-connection-pools-in-spring-boot-app) which is a false positive, and [another one](https://stackoverflow.com/questions/29330592/spring-initialize-multiple-connection-pools-at-startup) which is related to Spring, not Spring Boot, so please don't report this as dupe.