guice-3

Using a WebService with Akka Actors and the play framework

假如想象 提交于 2019-12-11 00:04:24
问题 I have built a web service using Play & Akka and now need to integrate another Webservice, where my web service is a client. My default controller (with an associated routes file) looks like class myController @Inject() (implicit val messagesApi: MessagesApi, config: play.api.Configuration) extends Controller with I18nSupport { // Actions } This spins up a large actor system and everything is good. One of the actors is defined as below - class ActorMgr ( jobId: Long, config: Config) extends

Guice 3.0 - ArrayIndexOutOfBoundsException on startup?

南笙酒味 提交于 2019-12-10 13:43:47
问题 Why Guice 3.0 throws this exception instead of a formatted message for wrong configurated components (@Inject is missing for example)? Exception in thread "main" com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 16640 at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553) at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419) at com.google.inject.internal.util.$CustomConcurrentHashMap

Java Generics : Is any meta information about the generic type preserved at runtime as well?

独自空忆成欢 提交于 2019-12-07 12:33:45
问题 Background My understanding of Java generics is it being completely a compile time feature (mainly focusing on type safety checks). The type information for any generic class is lost at runtime ( type erasure ). Still, i see many frameworks seem to leverage the type information at runtime as well. For example, google guice Providers. The guice provider can instantiate and provide new instances of it's generic type at runtime. class Container { @Inject public Container(Provider<Content>

Java Generics : Is any meta information about the generic type preserved at runtime as well?

牧云@^-^@ 提交于 2019-12-06 01:35:45
Background My understanding of Java generics is it being completely a compile time feature (mainly focusing on type safety checks). The type information for any generic class is lost at runtime ( type erasure ). Still, i see many frameworks seem to leverage the type information at runtime as well. For example, google guice Providers . The guice provider can instantiate and provide new instances of it's generic type at runtime. class Container { @Inject public Container(Provider<Content> contentProvider) { //This works at Runtime... but How ??? //When type's are not even preserved at runtime,

Why is a lambda expression breaking guice error handling when i try to start jetty?

ぐ巨炮叔叔 提交于 2019-12-01 18:53:19
问题 I face the following problem where i try to start jetty, i get the following exeption: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process [ERROR] org.apache.maven.surefire.testset.TestSetFailedException: java.lang.RuntimeException: com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 51966 [ERROR] at org.apache.maven.surefire.common.junit4.JUnit4RunListener

Why is a lambda expression breaking guice error handling when i try to start jetty?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 18:23:21
I face the following problem where i try to start jetty, i get the following exeption: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process [ERROR] org.apache.maven.surefire.testset.TestSetFailedException: java.lang.RuntimeException: com.google.inject.internal.util.$ComputationException: java.lang.ArrayIndexOutOfBoundsException: 51966 [ERROR] at org.apache.maven.surefire.common.junit4.JUnit4RunListener.rethrowAnyTestMechanismFailures(JUnit4RunListener.java:206) [ERROR] at org.apache.maven.surefire.junitcore

How to use Guice's AssistedInject?

落爺英雄遲暮 提交于 2019-11-29 19:41:54
I've read https://github.com/google/guice/wiki/AssistedInject , but it doesn't say how to pass in the values of the AssistedInject arguments. What would the injector.getInstance() call look like? Mairbek Khadikov Check the javadoc of FactoryModuleBuilder class. AssistedInject allows you to dynamically configure Factory for class instead of coding it by yourself. This is often useful when you have an object that has a dependencies that should be injected and some parameters that must be specified during creation of object. Example from the documentation is a RealPayment public class RealPayment

How to use Guice's AssistedInject?

时间秒杀一切 提交于 2019-11-28 15:27:28
问题 I've read https://github.com/google/guice/wiki/AssistedInject, but it doesn't say how to pass in the values of the AssistedInject arguments. What would the injector.getInstance() call look like? 回答1: Check the javadoc of FactoryModuleBuilder class. AssistedInject allows you to dynamically configure Factory for class instead of coding it by yourself. This is often useful when you have an object that has a dependencies that should be injected and some parameters that must be specified during

How can I wire up N chains of nodes in guice like filters

佐手、 提交于 2019-11-28 10:47:32
问题 I want to create node A(multiplexor) which has N node B's. Each node B has it's own node C and each node C has it's own node D and each node D has it's own node E. Let's say N=4 on number of B,C,D,E chains that A has. Ideally, each node E ends up with information like i=0, 1, 2, 3. On top of this, I may want to re-order B, C, D as they are pretty much like filters so I have them all implementing an interface with Response service(Request r); I would like desperately to stay away from assisted