Guice

Why use @Singleton over Scala's object in Play Framework?

梦想的初衷 提交于 2019-12-30 01:37:17
问题 I have been using Play! Framework for Scala for nearly a year now. I am currently using version 2.5.x. I am aware of the evolution of controllers in Play and how developers have been forced away from static object routes. I am also aware of the Guice usage in play. If you download activator and run: activator new my-test-app play-scala Activator will produce a template project for you. My question is specifically around this file of that template. my-test-app/app/services/Counter.scala

《Druid源码解析(1) Guice和Realtime流程》——图较精简,不错

吃可爱长大的小学妹 提交于 2019-12-30 01:05:43
https://zqhxuyuan.github.io/ 最近两年更新少 任何忧伤,都抵不过世界的美丽 2015-12-08 Druid源码解析(1) Guice和Realtime流程 Source druid Druid is a fast column-oriented distributed data store. http://druid.io/ 当启动Druid的服务,会启动一个java进程,比如 run_example_server.sh 会启动 io.druid.cli.Main example realtime . Guice Inject Main的buidler类包含了多种服务组, 比如server服务包括了Druid的大部分组件: 协调,历史,Broker,实时,Overlord等. injectMembers和toInstance注入实例化好的对象 12345 final Injector injector = GuiceInjectors.makeStartupInjector();final Cli<Runnable> cli = builder.build();final Runnable command = cli.parse(args);injector.injectMembers(command); //command已经是实例化好的线程类

Practical advice on using Jersey and Guice for RESTful service

牧云@^-^@ 提交于 2019-12-29 10:06:14
问题 From what I can find online, the state of the art for Guice + Jersey integration has stagnated since 2008 when it appears both teams reached an impasse. The crux of the issue is that JAX-RS annotations perform field and method injection and this doesn't play nicely with Guice's own dependency injection. A few examples which I've found don't go far enough to elucidate: Iqbalyusuf's post on Jersey + Guice on Google App Engine Java suffers from a lot of boilerplate (manually getting and calling

Guice + Tomcat potential memory leak

我的未来我决定 提交于 2019-12-29 06:44:09
问题 I have just started using Google Guice with my Tomcat webapp, and have noticed the following in the catalina.out file whenever the WAR file is undeployed: May 16, 2011 5:37:24 PM org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [/app] May 16, 2011 5:37:24 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [com.google.inject.internal.util.$Finalizer] but has failed to stop it.

custom Guice binding annotations with parameters

旧街凉风 提交于 2019-12-28 23:20:43
问题 I have successfully created a Guice binding annotation to inject single threaded java.util.concurrent.ExecutorService instances into a constructor. here is an example usage: public class ContainsSingleThreadedExecutorService { private final ExecutorService executorService; @Inject public ContainsSingleThreadedExecutorService(@SingleThreaded ExecutorService executorService) { this.executorService = executorService; } } I now want to create a similar annotation for multi-threaded executors,

Appengine with Google Cloud Endpoints and Guice

*爱你&永不变心* 提交于 2019-12-28 12:04:19
问题 So i want to use Guice in Appengine with Cloud Endpoints to inject my services, or daos - pretty common I guess, but I found no tutorial for this. Official Guice for Appengine documentation seems to be here: https://github.com/google/guice/wiki/GoogleAppEngine When configuring Guice you set up the com.google.inject.servlet.GuiceFilter to intercept every request "/*". And at some point you must initialize the modules. Like the documentation says a good place to do that is a

Injecting services into Scala Akka Actors with Google Guice

六眼飞鱼酱① 提交于 2019-12-25 14:25:24
问题 I have a couple of services that I want to inject into akka actors. There are three different types of actors I am working with, and each type will use different services. Currently I just have a module, instantiate an injector inside of the actor, and do the binding inside of each Crow. The issue is that for each other, they receive a new instance of the service. I did a little bit of reading and found http://www.typesafe.com/activator/template/activator-akka-scala-guice but the

Java: Can't get a working ServiceLoader

我怕爱的太早我们不能终老 提交于 2019-12-25 12:46:05
问题 I am very new to Java (coming from C# .NET background). Trying to create an "expansion/IoC" style architecture via a combination of Google Guice and ServiceLoader, but can't seem to get the ServiceLoader part working running Java 1.7.0_75 and IntelliJ IDEA 14. I have a module within my project which is effectively a base class library called ViProJ.Bcl that contains an interface called com.vipro.bcl.SimplePluginLoader. I have another module called ViProJ.TestModules which contains a single

Why is Eclipse not able to resolve Guice import in Play 2.2.x application?

谁说我不能喝 提交于 2019-12-25 07:06:56
问题 I'm trying to use Google Guice Injections in my Play 2.2.2 project. My build.sbt file contains this: libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, "com.google.inject" % "guice" % "4.0-beta", "ws.securesocial" %% "securesocial" % "2.1.4", "postgresql" % "postgresql" % "9.1-901-1.jdbc4" ) When running play dependencies , I can see that the guice dependency is being resolved correctly. However, when trying to make the import com.google.inject.* statement it seems that the library is

GWT RPC GWTTestCase + GUICE 2.0

五迷三道 提交于 2019-12-25 05:18:13
问题 Im trying to create an app with the GWT on the front end and GUICE on the backend served on the Google App Engine. I have created a very simple app using the example setup http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/#comment-49355 The app works fine, however I wanted to add some unit tests for the GWT RPC calls. I am trying to use the GWTTestCase as below: `public void testContactMessageService() { ContactMessage message = new ContactMessage(); message.setName("Jeff"); message