• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala ScalaModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Scala中net.codingwell.scalaguice.ScalaModule的典型用法代码示例。如果您正苦于以下问题:Scala ScalaModule类的具体用法?Scala ScalaModule怎么用?Scala ScalaModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ScalaModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。

示例1: Module

//设置package包名称以及导入依赖的类
import java.util.function.Function

import akka.actor.ActorRef
import com.google.inject.AbstractModule
import com.google.inject.name.Names
import com.google.inject.util.Providers
import controllers.{DefaultKnolxControllerComponents, KnolxControllerComponents}
import net.codingwell.scalaguice.ScalaModule
import play.libs.Akka
import schedulers.SessionsScheduler

class Module extends AbstractModule with ScalaModule {

  override def configure(): Unit = {
    bind[ActorRef]
      .annotatedWith(Names.named("SessionsScheduler"))
      .toProvider(Providers.guicify(Akka.providerOf(classOf[SessionsScheduler], "SessionsScheduler", Function.identity())))
      .asEagerSingleton

    bind(classOf[KnolxControllerComponents])
      .to(classOf[DefaultKnolxControllerComponents])
      .asEagerSingleton()
  }

} 
开发者ID:knoldus,项目名称:knolx-portal,代码行数:26,代码来源:Module.scala


示例2: Module

//设置package包名称以及导入依赖的类
import javax.inject._

import com.google.inject.AbstractModule
import net.codingwell.scalaguice.ScalaModule
import play.api.{Configuration, Environment}

import jobs._
import models.daos._
import models.services._


class Module(environment: Environment, configuration: Configuration)
    extends AbstractModule
    with ScalaModule {

  override def configure() = {
    bind[UserDAO].to[UserDAOImpl]
    bind[ClassroomDAO].to[ClassroomDAOImpl]

    bind[UserService].to[UserServiceImpl]
    bind[ClassroomService].to[ClassroomServiceImpl]

    bind[Startup].asEagerSingleton()
  }
} 
开发者ID:yoo-haemin,项目名称:hufs-classroom,代码行数:26,代码来源:Module.scala


示例3: SevenStepsModule

//设置package包名称以及导入依赖的类
package de.htwg.se.SevenSteps

import com.google.inject.AbstractModule
import com.google.inject.assistedinject.FactoryModuleBuilder
import de.htwg.se.SevenSteps.controller.IController
import de.htwg.se.SevenSteps.model.bag.IBag
import de.htwg.se.SevenSteps.model.fileIO.IFileIO
import de.htwg.se.SevenSteps.model.grid.{IGrid, IGridFactory}
import de.htwg.se.SevenSteps.model.player.IPlayers
import de.htwg.se.SevenSteps.model.{bag, fileIO, grid, player}
import net.codingwell.scalaguice.ScalaModule

class SevenStepsModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[IPlayers].to[player.basicImpl.Players]
    bind[IBag].to[bag.basicImpl.Bag]
    bind[IController].to[controller.basicImpl.Controller]
    bind[IFileIO].to[fileIO.json.Json]
    install(new FactoryModuleBuilder()
      .implement(classOf[IGrid], classOf[grid.basicImpl.Grid])
      .build(classOf[IGridFactory]))
  }
} 
开发者ID:GrimmT,项目名称:de.htwg.se.SevenSteps,代码行数:24,代码来源:SevenStepsModule.scala


示例4: ActorSystemProvider

//设置package包名称以及导入依赖的类
package com.franklevering.banking.infrastructure.dependencyinjection.modules

import akka.actor.ActorSystem
import com.franklevering.banking.infrastructure.dependencyinjection.extension.GuiceAkkaExtension
import com.google.inject.{AbstractModule, Inject, Injector, Provider}
import net.codingwell.scalaguice.ScalaModule

class ActorSystemProvider @Inject() (val injector:Injector) extends Provider[ActorSystem] {
  override def get(): ActorSystem = {
    val system = ActorSystem("banking-context")
    GuiceAkkaExtension(system).initialize(injector)
    system
  }
}
class AkkaModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[ActorSystem].toProvider[ActorSystemProvider].asEagerSingleton()
  }
} 
开发者ID:frankieleef,项目名称:banking,代码行数:20,代码来源:AkkaModule.scala


示例5: AkkaModule

//设置package包名称以及导入依赖的类
package com.nulabinc.backlog.migration.common.modules

import javax.inject.Inject

import akka.actor.ActorSystem
import com.google.inject.{AbstractModule, Injector, Provider}
import com.nulabinc.backlog.migration.common.modules.akkaguice.GuiceAkkaExtension
import com.nulabinc.backlog.migration.common.modules.AkkaModule.ActorSystemProvider
import com.typesafe.config.Config
import net.codingwell.scalaguice.ScalaModule

object AkkaModule {

  class ActorSystemProvider @Inject()(val config: Config, val injector: Injector) extends Provider[ActorSystem] {
    override def get() = {

      val system = ActorSystem.apply("main-actor-system", config)
      // add the GuiceAkkaExtension to the system, and initialize it with the Guice injector
      GuiceAkkaExtension(system).initialize(injector)
      system
    }
  }

}


class AkkaModule extends AbstractModule with ScalaModule {

  override def configure() {
    bind[ActorSystem].toProvider[ActorSystemProvider].asEagerSingleton()
  }
} 
开发者ID:nulab,项目名称:backlog-migration-common,代码行数:33,代码来源:AkkaModule.scala


示例6: HelloModule

//设置package包名称以及导入依赖的类
package modules

import javax.inject._

import com.google.inject.AbstractModule
import domain._
import infra.jdbc._
import net.codingwell.scalaguice.ScalaModule
import scalikejdbc.AutoSession
import support.IOContextProvider


class HelloModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bindRepository()
    bindIOContext()
  }

  private def bindRepository():Unit = {
    bind[AttendanceApplicationRepository].to[AttendanceApplicationRepositoryOnDB].in[Singleton]
    bind[AttendanceRepository].to[AttendanceRepositoryOnDB].in[Singleton]
    bind[ExtraworkApplicationRepository].to[ExtraworkApplicationRepositoryOnDB].in[Singleton]
    bind[GivenHolidayRepository].to[GivenHolidayRepositoryOnDB].in[Singleton]
    bind[HolidayApplicationRepository].to[HolidayApplicationRepositoryOnDB].in[Singleton]
    bind[OfficeRepository].to[OfficeRepositoryOnDB].in[Singleton]
    bind[OfficialHolidayRepository].to[OfficialHolidayRepositoryOnDB].in[Singleton]
    bind[RestRepository].to[RestRepositoryOnDB].in[Singleton]
    bind[SpaceRepository].to[SpaceRepositoryOnDB].in[Singleton]
    bind[TypetalkRepository].to[TypetalkRepositoryOnDB].in[Singleton]
    bind[UserRepository].to[UserRepositoryOnDB].in[Singleton]
  }

  private def bindIOContext():Unit = {
    bind[IOContextProvider].toInstance(new IOContextProviderOnJDBC(AutoSession))
  }
} 
开发者ID:tockri,项目名称:hello-next,代码行数:37,代码来源:HelloModule.scala


示例7: Module

//设置package包名称以及导入依赖的类
import com.eigenroute.authentication._
import com.eigenroute.id.{UUIDProvider, UUIDProviderImpl}
import com.eigenroute.plumbing.PublisherSubscriber
import com.eigenroute.scalikejdbchelpers.{DBConfig, ScalikeJDBCDevProdDBConfig, ScalikeJDBCSessionProvider, ScalikeJDBCSessionProviderImpl}
import com.eigenroute.time.{TimeProvider, TimeProviderImpl}
import com.google.inject.AbstractModule
import net.codingwell.scalaguice.ScalaModule
import plumbing.messagebroker.MessageBrokerMessageSubscriber


class Module extends AbstractModule with ScalaModule {

  override def configure() = {
    // bind[API].to[Facade]
    bind[TimeProvider].to[TimeProviderImpl]
    bind[UUIDProvider].to[UUIDProviderImpl]
    bind[JWTAlgorithmProvider].to[JWTAlgorithmProviderImpl]
    bind[JWTPublicKeyProvider].to[JWTPublicKeyProviderImpl]
    bind[JWTPrivateKeyProvider].to[JWTPrivateKeyProviderImpl]
    // bind[DAO].to[DAOImpl]
    bind[ScalikeJDBCSessionProvider].to[ScalikeJDBCSessionProviderImpl]
    bind[DBConfig].to[ScalikeJDBCDevProdDBConfig]
    bind[PublisherSubscriber].to[MessageBrokerMessageSubscriber]
  }

} 
开发者ID:shafiquejamal,项目名称:microservice-template-play,代码行数:27,代码来源:Module.scala


示例8: ConsulBot

//设置package包名称以及导入依赖的类
package mm4s.examples.consulbot

import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.stream.ActorMaterializer
import consulq.ConsulQuery
import mm4s.api.{Post, Posted}
import mm4s.bots.api.{Bot, BotID, Ready}
import net.codingwell.scalaguice.ScalaModule



class ConsulBot extends Actor with Bot with ActorLogging {
  import context.dispatcher
  implicit val mat: ActorMaterializer = ActorMaterializer()


  def receive: Receive = {
    case Ready(api, id) => context.become(ready(api, id))
  }

  def ready(api: ActorRef, id: BotID): Receive = {
    import context.system
    log.debug("ConsulBot [{}] ready", id.username)
    api ! Post("ConsulBot ready")

    {
      case Posted(t) if t.startsWith("@consul") =>
        log.debug("{} received {}", self.path.name, t)

        ConsulQuery().services().map { s =>
          s.foldLeft(
            """
              || name | address | port |
              ||------|--------|--------|""".stripMargin) {
            (acc, s) => acc ++ s"\n|${s.name}|${s.address}|${s.port}|"
          }
        }.foreach(api ! Post(_))
    }
  }

  override def preStart(): Unit = {
    log.debug("ConsulBot starting")
  }
}


class ConsulBotModule extends ScalaModule {
  def configure(): Unit = {
    bind[Bot].to[ConsulBot]
  }
}

object ConsulBotBoot4dev extends App {
  mm4s.bots.Boot.main(Array.empty)
} 
开发者ID:jw3,项目名称:mm4s-examples,代码行数:56,代码来源:ConsulBot.scala


示例9: LogSinkModule

//设置package包名称以及导入依赖的类
package io.neons.collector.application.guice.infrastructure.log.sink

import java.util.{Properties, UUID}

import com.google.inject.{AbstractModule, Inject, Provider}
import io.neons.collector.application.config.CollectorConfig
import io.neons.collector.application.guice.infrastructure.log.sink.LogSinkModule.KafkaLogSinkModuleProvider
import io.neons.collector.infrastructure.log.sink.KafkaLogSink
import io.neons.collector.model.log.{Log, LogSink}
import net.codingwell.scalaguice.ScalaModule
import org.apache.kafka.clients.producer.KafkaProducer

object LogSinkModule {
  class KafkaLogSinkModuleProvider @Inject()(collectorConfig: CollectorConfig) extends Provider[KafkaProducer[UUID, Log]] {
    override def get(): KafkaProducer[UUID, Log] = {
      val kafkaConfig = collectorConfig.sink.kafkaSinkConfig
      val properties = new Properties()
      properties.put("bootstrap.servers", kafkaConfig.host.concat(":").concat(kafkaConfig.port.toString))
      properties.put("client.id", kafkaConfig.clientId)
      properties.put("max.block.ms", "5000")
      properties.put("request.timeout.ms", "10000")
      properties.put("acks", "all")
      properties.put("key.serializer", "io.neons.collector.application.guice.infrastructure.log.sink.serialization.UuidSerializer")
      properties.put("value.serializer", "io.neons.collector.application.guice.infrastructure.log.sink.serialization.RawEventSerializer")

      new KafkaProducer[UUID, Log](properties)
    }
  }
}

class LogSinkModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[LogSink].to[KafkaLogSink].asEagerSingleton()
    bind[KafkaProducer[UUID, Log]].toProvider[KafkaLogSinkModuleProvider].asEagerSingleton()
  }
} 
开发者ID:NeonsIo,项目名称:collector,代码行数:37,代码来源:LogSinkModule.scala


示例10: ActorMaterializerModule

//设置package包名称以及导入依赖的类
package io.neons.collector.application.guice.application.akka.actor

import javax.inject.Inject

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import com.google.inject.{AbstractModule, Provider}
import io.neons.collector.application.guice.application.akka.actor.ActorMaterializerModule.ActorMaterializerProvider
import net.codingwell.scalaguice.ScalaModule

object ActorMaterializerModule {
  class ActorMaterializerProvider @Inject()(actorSystem: ActorSystem) extends Provider[ActorMaterializer] {
    override def get(): ActorMaterializer = ActorMaterializer.apply()(context = actorSystem)
  }
}

class ActorMaterializerModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[ActorMaterializer].toProvider[ActorMaterializerProvider].asEagerSingleton()
  }
} 
开发者ID:NeonsIo,项目名称:collector,代码行数:22,代码来源:ActorMaterializerModule.scala


示例11: AkkaModule

//设置package包名称以及导入依赖的类
package io.neons.collector.application.guice.application.akka.actor

import javax.inject.Inject

import akka.actor.ActorSystem
import com.google.inject.{AbstractModule, Injector, Provider}
import io.neons.collector.application.guice.application.akka.actor.AkkaModule.ActorSystemProvider
import net.codingwell.scalaguice.ScalaModule

object AkkaModule {
  class ActorSystemProvider @Inject()(injector: Injector) extends Provider[ActorSystem] {
    override def get = {
      val actorSystem = ActorSystem("collector")
      GuiceAkkaExtension(actorSystem).initialize(injector)
      actorSystem
    }
  }
}

class AkkaModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[ActorSystem].toProvider[ActorSystemProvider].asEagerSingleton()
  }
} 
开发者ID:NeonsIo,项目名称:collector,代码行数:25,代码来源:AkkaModule.scala


示例12: CollectorConfigModule

//设置package包名称以及导入依赖的类
package io.neons.collector.application.guice.application.config

import com.google.inject.{AbstractModule, Provider}
import com.typesafe.config.ConfigFactory
import io.neons.collector.application.config.CollectorConfig
import io.neons.collector.application.guice.application.config.CollectorConfigModule.CollectorConfigProvider
import net.codingwell.scalaguice.ScalaModule

object CollectorConfigModule {
  class CollectorConfigProvider extends Provider[CollectorConfig] {
    override def get(): CollectorConfig = {
      CollectorConfig.load(ConfigFactory.load())
    }
  }
}

class CollectorConfigModule extends AbstractModule with ScalaModule {
  override def configure(): Unit = {
    bind[CollectorConfig].toProvider[CollectorConfigProvider].asEagerSingleton()
  }
} 
开发者ID:NeonsIo,项目名称:collector,代码行数:22,代码来源:CollectorConfigModule.scala


示例13: RuleModule

//设置package包名称以及导入依赖的类
package br.unb.cic.poo.gol.model

import com.google.inject.AbstractModule
import net.codingwell.scalaguice.ScalaModule
import net.codingwell.scalaguice.ScalaMultibinder
import br.unb.cic.poo.gol.HighLife

class RuleModule extends AbstractModule with ScalaModule{
  
  override def configure() : Unit = {
    val setBinder = ScalaMultibinder.newSetBinder[Rule](binder)
    setBinder.addBinding.to(classOf[ConwayRule])
    setBinder.addBinding.to(classOf[HighLife])
    
    //Implementação ideal porem https://github.com/codingwell/scala-guice/issues/50
    /*val mapBinder = ScalaMapBinder.newMapBinder[Int, Rule](binder)
    mapBinder.addBinding(1).to(classOf[ConwayRule])
    mapBinder.addBinding(2).to(classOf[HighLife])*/
  }
  
} 
开发者ID:rdinizcal,项目名称:GameOfLife-TP1,代码行数:22,代码来源:RuleModule.scala


示例14: BeamAgentModule

//设置package包名称以及导入依赖的类
package beam.sim.modules

import akka.actor.ActorSystem
import beam.playground.akkaguice.{AkkaGuiceSupport, GuiceAkkaExtension}
import beam.sim.BeamServices
import beam.sim.modules.BeamAgentModule.ActorSystemProvider
import com.google.inject.{AbstractModule, Inject, Injector, Provider}
import com.typesafe.config.Config
import net.codingwell.scalaguice.ScalaModule
import org.slf4j.{Logger, LoggerFactory}


object BeamAgentModule {
  private val logger: Logger = LoggerFactory.getLogger(classOf[BeamAgentModule])

  class ActorSystemProvider @Inject()(val injector: Injector, config: Config) extends Provider[ActorSystem] {
    override def get(): ActorSystem = {
      val system = ActorSystem("beam-actor-system", config)
      // add the GuiceAkkaExtension to the system, and initialize it with the Guice injector
      GuiceAkkaExtension(system).initialize(injector)
      system
    }
  }
}


class BeamAgentModule extends AbstractModule with AkkaGuiceSupport with ScalaModule {
  override def configure(): Unit = {
    bind[ActorSystem].toProvider[ActorSystemProvider].asEagerSingleton()
    bind[BeamServices].asEagerSingleton()
//    bind[BeamAgentScheduler].asEagerSingleton()
  }
} 
开发者ID:LBNL-UCB-STI,项目名称:beam,代码行数:34,代码来源:BeamAgentModule.scala


示例15: ConfigModule

//设置package包名称以及导入依赖的类
package org.scardiecat.styx.clustermanager.di

import com.google.inject.AbstractModule
import com.typesafe.config.{ConfigFactory, Config}
import net.codingwell.scalaguice.ScalaModule

class ConfigModule(config:Config, actorSystemName:String)  extends AbstractModule with ScalaModule{
  // Create an Akka system
  val finalConfig =
    ConfigFactory.parseString(
      s"""
         |styx.actor-system-name=$actorSystemName
         """.stripMargin).
      withFallback(config)

  override  def configure(): Unit = {
    bind[Config].toInstance(this.finalConfig)
  }
} 
开发者ID:Scardiecat,项目名称:styx-cluster-manager,代码行数:20,代码来源:ConfigModule.scala


示例16: ConfigModule

//设置package包名称以及导入依赖的类
package org.scardiecat.styx.seednode.main

import com.google.inject.AbstractModule
import com.typesafe.config.{ConfigFactory, Config}
import net.codingwell.scalaguice.ScalaModule

class ConfigModule(config:Config, actorSystemName:String)  extends AbstractModule with ScalaModule{
  val finalConfig =
    ConfigFactory.parseString(
      s"""
         |styx.actor-system-name=$actorSystemName
         """.stripMargin).
        withFallback(config)

  override  def configure(): Unit = {
    bind[Config].toInstance(this.finalConfig)
  }
} 
开发者ID:Scardiecat,项目名称:styx-akka-seed-node,代码行数:19,代码来源:ConfigModule.scala


示例17: Module

//设置package包名称以及导入依赖的类
package modules

import access._
import access.authentication.{AuthenticationFacade, PasswordResetCodeSender, PasswordResetCodeSenderImpl}
import access.registration.{AccountActivationCodeSender, AccountActivationCodeSenderImpl, RegistrationFacade}
import asynccommunication.{Emailer, EmailerImpl}
import com.eigenroute.id.{UUIDProvider, UUIDProviderImpl}
import com.eigenroute.scalikejdbchelpers.{DBConfig, ScalikeJDBCDevProdDBConfig, ScalikeJDBCSessionProvider, ScalikeJDBCSessionProviderImpl}
import com.eigenroute.time.{TimeProvider, TimeProviderImpl}
import com.google.inject.AbstractModule
import entrypoint.{AuthenticationAPI, RegistrationAPI, UserAPI}
import net.codingwell.scalaguice.ScalaModule
import user.UserFacade

class Module extends AbstractModule with ScalaModule {

  override def configure() {
    bind[ScalikeJDBCSessionProvider].to[ScalikeJDBCSessionProviderImpl]
    bind[TimeProvider].to[TimeProviderImpl]
    bind[UUIDProvider].to[UUIDProviderImpl]
    bind[RegistrationAPI].to[RegistrationFacade]
    bind[AuthenticationAPI].to[AuthenticationFacade]
    bind[UserAPI].to[UserFacade]
    bind[DBConfig].to[ScalikeJDBCDevProdDBConfig]
    bind[JWTAlgorithmProvider].to[JWTAlgorithmProviderImpl]
    bind[JWTPublicKeyProvider].to[JWTPublicKeyProviderImpl]
    bind[JWTPrivateKeyProvider].to[JWTPrivateKeyProviderImpl]
    bind[Emailer].to[EmailerImpl]
    bind[AccountActivationCodeSender].to[AccountActivationCodeSenderImpl]
    bind[PasswordResetCodeSender].to[PasswordResetCodeSenderImpl]
    bind[CodeSender].to[CodeSenderImpl]
  }

} 
开发者ID:shafiquejamal,项目名称:api-gateway-template,代码行数:35,代码来源:Module.scala


示例18: ServerDiModule

//设置package包名称以及导入依赖的类
package com.donoroncall.server.di

import com.donoroncall.server.connectors.{RedisConnector, MysqlConnector}
import com.donoroncall.server.rest.ServerInterface
import com.donoroncall.server.rest.controllers.authentication.session.{RedisSessionHandler, InMemorySessionHandler, SessionHandler}
import com.donoroncall.server.rest.undertow.UndertowApiServer
import com.google.inject.{AbstractModule, Binder, Module}
import com.typesafe.config.Config
import net.codingwell.scalaguice.ScalaModule


class ServerDiModule(config: Config) extends AbstractModule with ScalaModule {
  override def configure(): Unit = {

    bind[Config].toInstance(config)
    bind[MysqlConnector].asInstanceOf[Singleton]

    config.getString("server.security.sessionHandler") match {

      case "InMemorySessionHandler" => bind[SessionHandler].to[InMemorySessionHandler].asInstanceOf[Singleton]

      case "RedisSessionHandler" => {
        bind[RedisConnector].asInstanceOf[Singleton]
        bind[SessionHandler].to[RedisSessionHandler].asInstanceOf[Singleton]
      }

      case _ => bind[SessionHandler].to[InMemorySessionHandler].asInstanceOf[Singleton]
    }
    bind[ServerInterface].to[UndertowApiServer].asInstanceOf[Singleton]
  }
} 
开发者ID:donorcall01,项目名称:DonorOnCall_Server,代码行数:32,代码来源:ServerDiModule.scala


示例19: UserModule

//设置package包名称以及导入依赖的类
package com.clemble.loveit.user

import com.clemble.loveit.user.service._
import com.clemble.loveit.user.service.repository._
import com.clemble.loveit.user.service.repository.mongo.{MongoInvitationRepository, MongoUserRepository}
import javax.inject.{Named, Singleton}

import com.clemble.loveit.common.mongo.JSONCollectionFactory
import com.google.inject.Provides
import net.codingwell.scalaguice.ScalaModule
import org.joda.time.DateTimeZone
import play.api.libs.ws.WSClient
import play.api.{Configuration, Environment, Mode}
import play.modules.reactivemongo.ReactiveMongoApi
import reactivemongo.play.json.collection.JSONCollection

import scala.concurrent.ExecutionContext


class UserModule(env: Environment, conf: Configuration) extends ScalaModule {

  override def configure(): Unit = {
    DateTimeZone.setDefault(DateTimeZone.UTC)

    bind(classOf[UserService]).to(classOf[SimpleUserService])
    bind(classOf[UserRepository]).to(classOf[MongoUserRepository])

    bind(classOf[InvitationRepository]).to(classOf[MongoInvitationRepository])
    bind(classOf[InvitationService]).to(classOf[SimpleInvitationService])
  }

  @Provides
  @Named("user")
  @Singleton
  def userMongoCollection(mongoApi: ReactiveMongoApi, ec: ExecutionContext): JSONCollection = {
    JSONCollectionFactory.create("user", mongoApi, ec, env)
  }

  @Provides
  @Named("invitation")
  @Singleton
  def inviteMongoCollection(mongoApi: ReactiveMongoApi, ec: ExecutionContext): JSONCollection = {
    JSONCollectionFactory.create("invitation", mongoApi, ec, env)
  }


  @Provides
  @Singleton
  def subscriptionManager(ws: WSClient, ec: ExecutionContext): SubscriptionManager = {
    if (env.mode == Mode.Test) {
      TestSubscriptionManager
    } else {
      val apiKey = conf.getString("email.mailgun.api.key").get
      MailgunSubscriptionManager(apiKey, ws, ec)
    }
  }



} 
开发者ID:thankyo,项目名称:thank,代码行数:61,代码来源:UserModule.scala


示例20: AkkaModule

//设置package包名称以及导入依赖的类
package play.modules.io.joaovasques.playspark.akkaguice

import akka.actor.ActorSystem
import play.modules.io.joaovasques.playspark.akkaguice.AkkaModule.ActorSystemProvider
import com.google.inject.{AbstractModule, Injector, Provider}
import com.typesafe.config.Config
import net.codingwell.scalaguice.ScalaModule
import javax.inject.Inject

object AkkaModule {
  class ActorSystemProvider @Inject() (val config: Config, val injector: Injector) extends Provider[ActorSystem] {
    override def get() = {
      val system = ActorSystem("play-spark-main-actor-system", config)
      // add the GuiceAkkaExtension to the system, and initialize it with the Guice injector
      GuiceAkkaExtension(system).initialize(injector)
      system
    }
  }
}


class AkkaModule extends AbstractModule with ScalaModule {

  override def configure() {
    bind[ActorSystem].toProvider[ActorSystemProvider].asEagerSingleton()
  }
} 
开发者ID:zqhxuyuan,项目名称:first-player,代码行数:28,代码来源:AkkaModule.scala



注:本文中的net.codingwell.scalaguice.ScalaModule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala HasDatabaseConfigProvider类代码示例发布时间:2022-05-23
下一篇:
Scala ParamMap类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap