{"action":"created","issue":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/701","repository_url":"https://api.github.com/repos/brettwooldridge/HikariCP","labels_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/701/labels{/name}","comments_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/701/comments","events_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/701/events","html_url":"https://github.com/brettwooldridge/HikariCP/issues/701","id":171393199,"number":701,"title":"Consider relaxing the check between dataSourceClassName and driverClassName","user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-16T12:15:16Z","updated_at":"2016-08-17T10:42:26Z","closed_at":null,"body":"If one sets both these properties, they'll get:\r\n\r\n```\r\nCaused by: java.lang.IllegalArgumentException: cannot use driverClassName and dataSourceClassName together.\r\n    at com.zaxxer.hikari.HikariConfig.validate(HikariConfig.java:770) ~[HikariCP-2.4.7.jar:na]\r\n```\r\n\r\nSee https://github.com/spring-projects/spring-boot/issues/6568\r\n\r\nAs you are aware already, Spring Boot will automatically set the `driverClassName` value. This is a convenience for the user: we detect the driver based on the jdbc url. Once Spring Boot has initialized the `HikariDataSource`, it can further be tuned via our `spring.datasource.hikari` configuration namespace.\r\n\r\nConsidering it makes sense that someone set url/driver/user/pass and then after changes his mind and set `dataSourceClassName`, how about relaxing that check so that the last set wins? If the user defines a `spring.datasource.hikari.data-source-class-name`, that value will be used rather than the driver class name that was set automatically.\r\n\r\nThe reason I am asking here rather than trying to fix that on our side is that I have no guarantee that this will happen: as a user you could create a custom `HikariDataSource` on whatever namespace you want (e.g. `app.my-datasource`) or no namespace at all. So I couldn't look for `spring.datasource.hikari.data-source-class-name` in the environment because a user may have customized that so that `app.my-datasource.data-source-class-name` should be used instead. There's no way for me to know that; I shouldn't really.\r\n"},"comment":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/comments/240376488","html_url":"https://github.com/brettwooldridge/HikariCP/issues/701#issuecomment-240376488","issue_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/701","id":240376488,"user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T10:42:26Z","updated_at":"2016-08-17T10:42:26Z","body":"Thanks for the explanation!\r\n\r\n> Given that Spring Boot automatically sets the driver URL, why not disallow \"spring.datasource.hikari.data-source-class-name\" across the board?\r\n\r\nI already explained why:\r\n\r\n> I have no guarantee that this will happen: as a user you could create a custom HikariDataSource on whatever namespace you want (e.g. app.my-datasource) or no namespace at all. So I couldn't look for spring.datasource.hikari.data-source-class-name in the environment because a user may have customized that so that app.my-datasource.data-source-class-name should be used instead. There's no way for me to know that;\r\n\r\nOK, how about changing the error message so that you indicate the values that have been set? It would help users figuring out that the other value isn't set in their configuration, giving them a chance to get Spring Boot did."}}
{"actor":{"display_login":"snicoll"}}