Repository navigation
[7.x] Fix the default datasource setting in the docs, explain startup usage - #912
Merged
Merged
Conversation
The docs named a non-existent ebeanconfig.datasource.default setting to choose the default Ebean server; it's play.ebean.defaultDatasource. Also explain that components using Ebean while they get created have to depend on DynamicEvolutions, which creates the Ebean databases, that this doesn't mean that the evolutions have been applied yet, and how to let Play apply them automatically in dev mode only.
In dev mode, Play only waits for pending evolutions to be confirmed by default, i.e. without autoApply. And with autoApply, a regenerated 1.sql makes Play apply the downs of its previous version first, which drops the tables, so the development data gets lost.
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
7.x.The docs named a non-existent
ebeanconfig.datasource.defaultsetting to choose the default Ebean server, but it'splay.ebean.defaultDatasource(as reported in #145).Also add a section about using Ebean during application startup (see #457 and #65):
DynamicEvolutions, which creates the Ebean databases. Otherwise Ebean tries to create the database itself from its own configuration, which usually fails and leaves Ebean unusable until the JVM restarts. LaterNoClassDefFoundError: Could not initialize class ...errors only point back to that first failure.ApplicationEvolutions), and can't show the evolutions page if the application fails to start. So the docs recommend not to use the database schema while components get created, or to let Play apply evolutions automatically, limited to dev mode viaPlayKeys.devSettings, which is also what Evolutions not run property on play 2.8 #220 asks for.Testing
main: a repository created via Guice'srequestStaticInjectionthat callsDB.getDefault()in its constructor makes the application fail to start, in prod as well as in dev mode. With a dependency onDynamicEvolutions, as in the new docs sample, it starts.ApplicationEvolutions. WithautoApply, it starts.cd docs && sbt "validateCode; test"passes.