-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Configuration refactor #6001
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
Configuration refactor #6001
Conversation
| * @param environment the database environment | ||
| * @return a data source backed by a connection pool | ||
| */ | ||
| public DataSource create(String name, Configuration configuration, Environment environment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For binary compatibility reasons, we should keep a deprecated version of this create method. Default implementation can be used here to enable a easier transition:
@Deprecated
public DataSource create(String name, Configuration configuration, Environment environment);
default DataSource create(String name, Config config, Environment environment) {
return create(name, new Configuration(config), environment);
}Or the opposite use between the two methods using Configuration.underlying().
|
@gmethvin I've had the impression that you are trying to keep compatibility here, so I made some comments regarding compatibility issues. |
|
@marcospereira This doesn't need to be binary compatible (it's going into 2.6.0) but the goal is that most code would just work upon upgrade, just with deprecation warnings. |
7ae1244 to
0076b9f
Compare
|
The build is failing most likely because play-slick is using |
|
There was one error in the template build likely related to the fact that play-slick still uses |
130f845 to
4519421
Compare
|
@marcospereira I think I managed to handle all significant migration issues. I've had to use different method names in |
|
@gmethvin LGTM. Please, rebase so I can merge it. :-) |
play.Configurationand prefer rawcom.typesafe.config.Config.play.api.Configurationand prefer several methods currently onplay.api.PlayConfig, includingget[T: ConfigLoader]andgetOptional[T: ConfigLoader]that use theConfigLoadertypeclass to load arbitrary types.play.Configuration.This fixes several API issues with the current classes:
reference.confto declare default values. This is not idiomatic Config usage.play.api.Configurationhas many apparently unnecessary that return Java types. Now there is one method that can be used with a typeclass to load any type you want.play.Configurationprovides little in terms of functionality over rawConfigand is an unnecessary level of indirection.