This repository was archived by the owner on Apr 23, 2019. It is now read-only.
[WIP] Simplify dagger modules#10
Merged
wsargent merged 5 commits intoplayframework:2.6.xfrom May 2, 2017
Merged
Conversation
/LICENSE:
wrote /LICENSE
**/plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.0-M5")
| @Singleton | ||
| @Provides | ||
| public Clock providesClock() { | ||
| public Clock clock() { |
Member
There was a problem hiding this comment.
You won't need a clock module:
There is a TODO, but you can reuse that clock anyway.
Member
Author
There was a problem hiding this comment.
This is to demo the Clock injection though
| @Override | ||
| public Application load(Context context) { | ||
| final ClassLoader classLoader = context.environment().classLoader(); | ||
| final Optional<LoggerConfigurator> opt = LoggerConfigurator.fromClassLoader(classLoader); |
Member
There was a problem hiding this comment.
You still need to call the LoggerConfigurator here. See this example:
| put(play.api.i18n.Langs.class, langs); | ||
| }})); | ||
| } | ||
| extraMappings.put(JavaHandlerComponents.class, () -> new DefaultJavaHandlerComponents(simpleInjector.asScala(), actionCreator(), httpConfiguration(), executionContext(), javaContextComponents())); |
Member
There was a problem hiding this comment.
This probably should be solved by BuiltInComponentsFromContext itself.
| /** | ||
| * A simple injector with additional classes... | ||
| */ | ||
| public class SimpleInjector implements Injector { |
Member
Author
There was a problem hiding this comment.
I'm not sure if that's any better -- we have a java injector() method that would call out to a scala one, and then convert it back to java...
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Uses the built in components to leverage Play application.
Still isn't all the way through as the body parser is failing on injection.
UPDATE: Got the body parser to work, however there is still some global state being accessed: