Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Adam Warski
    @adamw
    This message was deleted
    integration with typesafe-config would be possible for sure ... maybe something like this:
    • there should be a single dependency of type Config available
    • any parameters marked with with a config path (*) would be looked up in the config
    now there's the question on how you would mark those parameters - with an annotation? but then, what about e.g. default values? any ideas? :)
    Michael McFarland
    @mikedmcfarland

    I'm a little surprised by the following behavior
    given a type PlatformsPage with dependencies

    class PlatformsPage(platformStore:PlatformStore,platformBackend:(BackendScope[Props,State] => Backend))

    I'm trying to create a factory method (platformsBackend) as a def.

    trait PlatformsModule {
      lazy val platformsPage = wire[PlatformsPage]
      lazy val platformsStore = wire[PlatformStore]
      def platformsBackend(scope:BackendScope[Props,State]):Backend = new Backend(scope)
    }

    This results in an error:

    Cannot find a value of type: [japgolly.scalajs.react.BackendScope[spatutorial.client.modules.platform.Props,spatutorial.client.modules.platform.State] => spatutorial.client.modules.platform.Backend]

    however these versions work

    lazy val platformsBackend:BackendScope[Props,State] => Backend = new Backend(_)
    type BackendFactory = BackendScope[Props,State] => Backend
    lazy val platformsBackend:BackendFactory = new Backend(_)

    can function defs not be used to create factory dependencies?

    Sorry if that's clearly stated, or I'm missing something obvious. Macwire has been a joy to use
    Adam Warski
    @adamw
    defs aren't currently automatically converted to function values, but that would be definitely a good feature to add - could you create a GH issue?
    Michael McFarland
    @mikedmcfarland
    Sure, adamw/macwire#43
    Adam Warski
    @adamw
    Thanks :)
    Steven Heidel
    @stevenheidel
    Is there any reason why the latest versions weren't released for Scala 2.10?
    Adam Warski
    @adamw
    no, I think nobody simply updated the scala-2.10 branch :)
    Steven Heidel
    @stevenheidel
    How much work do you think that would be?
    Adam Warski
    @adamw
    I suspect not much, there are some differences in 2.10 and 2.11 macros, but these are only string replacements
    Jisoo Park
    @guersam
    Have anyone used Macwire 2.0 with Play 2.4? I tried to update but it fails with the following errors:
    [error] /home/guersam/workspace/github/macwire/examples/play24/app/com/softwaremill/play24/AppApplicationLoader.scala:36: Found multiple values of type [slick.driver.H2Driver.api.Database]: [List(db, db)]
    [error]   val seed = wire[Seed]
    [error]                  ^
    [error] /home/guersam/workspace/github/macwire/examples/play24/app/com/softwaremill/play24/AppApplicationLoader.scala:31: Cannot find a value of type: [String]
    [error]   lazy val router: Router = wire[Routes] withPrefix "/"
    [error]                                 ^
    [error] two errors found
    [error] (compile:compileIncremental) Compilation failed
    It seems that macwire 2.0
    • recognizes overridden (abstract) member as another value
    • does not take secondary constructors into account (even if it's annotated with @javax.inject.Inject())
    Jisoo Park
    @guersam
    Just opened adamw/macwire#82
    Renato Cavalcanti
    @renatocaval
    Hi guys, do any of you have encountered issues play logging and macwire?
    If I use this example: https://github.com/adamw/macwire#play24x, logging get muted
    I don’t think the problem resides in macwire, but in extending Play’s ApplicationLoader
    My impression is that somehow the logging configuration won't be loaded
    Renato Cavalcanti
    @renatocaval
    Ok, this it the trick
    when using macwire with play, make sure you configure the logging as such:
    class AppApplicationLoader extends ApplicationLoader {
      def load(context: Context) = {
    
        Logger.configure(context.environment)
    
        (new BuiltInComponentsFromContext(context) with AppComponents).application
      }
    }
    without that you’ll get nothing in your logs
    will send a PR to the README file and example/play24
    Stevo Slavić
    @sslavic
    hi there
    I'm wondering what are some tried good practices macwire users apply to pass configuration properties during wiring
    Adam Warski
    @adamw
    I'm using traits which read from typesafe config sub-Config objects
    so a regular type :)
    Aleksandrov Vladimir
    @invis87
    Hello everyone!
    I have a question about using Play+Macwire+Akka
    How can I inject Play's ActorSystem with macwire?
    in documentation they says "import play.api.libs.concurrent.Akka"
    it is works, but not with Macwire...
    Adam Warski
    @adamw
    what's the contructor that you are trying to wire? maybe you can share a code fragment showing what you try to do?
    Aleksandrov Vladimir
    @invis87

    Actually it is working now :)

    import play.api.Play.current
    import play.api.libs.concurrent.Akka

    trait ActorsModule {

    lazy val actorSystem = Akka.system
    }

    this module is fine. The problem was here

    object Global extends GlobalSettings with Macwire {

    val wired = wiredInModule(Application)

    override def getControllerInstanceA = wired.lookupSingleOrThrow(controllerClass)
    }

    I made wired lazy and all goes fine :)

    Adam Warski
    @adamw
    ah, great to hear :)
    so it was the initialization order
    common with lazy vals :)
    Aleksandrov Vladimir
    @invis87
    indeed :)
    Aleksandrov Vladimir
    @invis87
    One more question ^^
    If I have a class (PostgreDB for example) that use DBPoolActor for operations. How can I inject it?
    I can't write like this:
    class PostgreDatabase(dbPoolActor: ActorRef)
    because I have more than one Actors in my system that I want to inject
    Looks like I should use tags
    Aleksandrov Vladimir
    @invis87
    buuuuut I dont understand how use it properly
    I have:
    import play.api.Play.current
    import play.api.libs.concurrent.Akka
    
    trait ActorsModule {
    
      lazy val actorSystem = Akka.system
      lazy val dbPoolActor = actorSystem.actorOf(Props(wire[DBPoolActor])).taggedWith[DBPoolActor]
    }
    and DB
    class PostgreDatabase(dBPoolActor: ActorRef @@ DBPoolActor) extends Database { ...
    }
    But how my DatabaseModule should looks like???
    trait DatabaseModule {
      lazy val database: Database = ???
    }
    Aleksandrov Vladimir
    @invis87
    When I am trying
    lazy val database: Database = new PostgreDatabase(wire[ActorRef @@ DBPoolActor])
    I get error
    Compilation error[Cannot find constructor for WeakTypeTag[com.softwaremill.macwire.@@[akka.actor.ActorRef,actors.DBPoolActor]]]
    Aleksandrov Vladimir
    @invis87

    hmmm, looks like I understand :)

    trait DatabaseModule extends ActorsModule {
      lazy val database: Database = wire[PostgreDatabase]
    }

    this works fine

    Adam Warski
    @adamw
    :) yes, that's how you should use tags
    Erik LaBianca
    @easel
    are macwire builds for scala.js kept up to date? I’m seeing unresolved dependency: com.softwaremill.macwire#macros_sjs0.6_2.11;2.2.0: not found adding it with %%%
    Adam Warski
    @adamw
    I don't think there ever was a dedicated scala js build
    doesn't it work using just %%?
    Adam Warski
    @adamw
    @easel I just updated the scalajs example to newest of everything and I think it works fine with %%, no dedicated build neeeded, see: https://github.com/adamw/macwire/tree/master/examples/scalajs
    Erik LaBianca
    @easel
    Ah silly me. It’s compile-time only, I suppose so no %%% needed. Thanks =p