-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.apache.tomcat.jdbc.pool.DataSource register with jmx #1590
Comments
This would work too:
|
This does work. But it has one problem when jmxEnabled is set to false: The application throws this error, because getJmxPool() returns null
|
That looks like a completely unrelated problem (the pool properties are not initialized until the pool is used). |
Or maybe not. Maybe you just need to put a check in there so you don't create the |
You could put that in the |
The @ConditionalOnExpression solution works great.
I was looking for the TomcatDataSourceConfiguration class but there is only one such class and it's located in a test class (TomcatDataSourceConfigurationTests). |
Sorry, that was me remembering Spring Boot 1.0.x. The only way to do it generically and safely now might be to add a |
It turns out registering the JMX information by default can cause some issues if you use Spring's Test Context Framework. I've hit this trying to upgrade Sagan. By default, tests with
I can't find an easy way to fix this so I think we need to change |
If the DataSource is a Tomcat one we force it to register an MBean if spring.jmx.enabled=true Fixes spring-projectsgh-1590
Change the default value of spring.datasource.jmx-enabled to false to prevent InstanceAlreadyExistsException problems when using the Spring Test Framework. Fixes spring-projectsgh-1590
1.2.0.BUILD-SNAPSHOT
Would be nice if the DataSource object registers itself with jmx (if jmx is enabled)
I tried to enable it with
spring.datasource.jmxEnabled=true
But it looks like this property does nothing.
I can use the following code to register the DataSource in my application
The text was updated successfully, but these errors were encountered: