I have a Spring Boot 1.5 app which is configured with an application.yml
file.
I need to manage the connection pool which is default - Tomcat.
The problem is that the application.yml
has a datasources
property for several datasources.
My global datasource.max-active=10
(UPDATE: datasource.tomcat.max-active=10
is ignored too) is being completely ignored (I created a test to see what datasource is being injected, and default maxActive
in them is set to 100). I have to add it to every datasource separately to make the pool work the way I need it to.
The application.yml
looks like this (this is only part of it), and it creates datasource with maxActive=10
, but there is bunch of repetitions:
spring:
.... #bunch of stuff, deleted for simplicity
datasource: #Added by me, ignored by Spring
max-active: 10 #Added by me, ignored by Spring
datasources:
datasource1:
url: jdbc:mysql://url:port1
max-active: 10 #Added by me, works
datasource2:
url: jdbc:mysql://url:port2
max-active: 10 #Added by me, works
Question: what is the correct way to set the max-active
property globally to avoid this repetition?
Thanks.