play-slick icon indicating copy to clipboard operation
play-slick copied to clipboard

Suggest removing jdbc dependency

Open richdougherty opened this issue 10 years ago • 3 comments

The standard Play template bundles the jdbc dependency. Users will usually need to remove this dependency when they add the play-slick dependency. Mention this in the docs.

Could also mention that the error A binding to play.api.db.DBApi was already configured happens when both jdbc and play-slick are on the classpath together.

richdougherty avatar Jun 21 '15 22:06 richdougherty

Doc for this already exists here: https://www.playframework.com/documentation/2.4.x/PlaySlickFAQ#A-binding-to-play.api.db.DBApi-was-already-configured

I guess the issue is that it's not easy to discover. If you have something in mind please share :-)

dotta avatar Jun 22 '15 07:06 dotta

Actually it seems to be enough to deactivate the incompatible module in "application.conf":

play.modules.disabled += "play.api.db.DBModule"

Is this bad? Should it be documented? At least it allows you to still have access for instance to the Databases object, which was very useful in my case.

jdelafon avatar Mar 10 '17 08:03 jdelafon

Hey @jdelafon,

Yes, if you want to use Databases object, then you can keep the jdbc dependency and just disable the DBModule. Just keep in mind that by disabling DBModule you won't be able to inject instances of play.api.db.Database and play.api.db.DBApi (unless you provide your own bindings).

marcospereira avatar Mar 13 '17 17:03 marcospereira