Questions tagged [guice-3]

Google Guice 3.0 Release

Guice 3 is version of Google Guice. Link to guice tag.

New Features are supported in Guice release 3.

  • JSR 330 Support
  • New Persist Extension
  • ToConstructor Bindings

and many such more features are introduced.

Reference

103 questions
1
vote
0 answers

Serenity cross platform unified solution

I am trying to make the existing solution to work on any platform. It's easy to make a custom driver extending the DriverSource class, but I still have to resolve the different page object injection (running on a mobile device for example has a…
1
vote
1 answer

Guice - Binding an instance created by assisted injection factory

Let's say that there's class A that's constructor looks something like that: public A(@Assited long id, @Assisten String name, ServiceA serviceA, ServiceB serviceB) And there's AFactory: public interface AFactory{ A create(long id, String…
slashms
  • 928
  • 9
  • 26
1
vote
1 answer

How to use Guice's AssistedInject factories along with service loader?

In my guice module I have multiple factories like shown below: install(new FactoryModuleBuilder().implement(SportsCar.class,Ferrari.class).build(FerrariFactory.class)); install(new…
Crusaderpyro
  • 2,163
  • 5
  • 29
  • 53
1
vote
1 answer

Guice : conditionally instantiate 1 concrete implementation of an interface (among many) at runtime

I am pretty new to Guice and have been trying to see if my problem is solvable with Guice. I have a main Driver class which looks like this : public class Driver{ execute(){ Manager m = injector.getInstance(Manager.class); } } public class…
sharath
  • 3,501
  • 9
  • 47
  • 72
1
vote
1 answer

Using Multiple Modules which have Same binding to different types

I have two different Modules which have different bindings to same interface and multiple sub modules. Example below public PublisherModule { public void configure() { bind(ITransport.class).to(TCPTransport.class) install(new…
Krishna
  • 23
  • 1
  • 6
1
vote
1 answer

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

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…
Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
1
vote
1 answer

What Guice MethodInterceptor should return

I am trying to find an answer what should be returned by Guice MethodInterceptor. What is difference between returning methodInvocation.proceed(); and returning null; Here is my situation: in some cases user has right to invoke some method in some…
Marcin
  • 7
  • 3
1
vote
0 answers

The ResourceConfig instance does not contain any root resource classes. (Guice+Jersey+Jboss)

I am trying to port my rest-app to JBoss (Guice 3.0 + Jersey 1.19 on JBoss 7), it works like a charm on tomcat 7, but i am stumbling on the same Resource-Config-Exception on my jboss 7: Exception starting filter guiceFilter:…
noircc
  • 650
  • 10
  • 28
1
vote
1 answer

Google guice not working without using implemented by

I have a interface as public interface ConfFileLoader { public Map getResultMap() throws SecurityException, IOException; } and a class that imlements it as public class ConfYamlLoader implements ConfFileLoader{ @Override …
Dhruv Pal
  • 849
  • 2
  • 10
  • 25
1
vote
2 answers

How inject 3 instances of same type with different dependence by Guice?

I am using Guice to manager my class dependence. I have a LogicHandler class which depended on several Components class. public interface LogicHandler { private Component component1; private Component component2; private…
crisli
  • 552
  • 1
  • 6
  • 17
1
vote
1 answer

Binding a 2-D array in Guice

I have to create an object of ModelWeights using Guice Dependency injection. How can I bind a double[][] array using Guice dependency injection during runtime? public class MW { private double[][] weights; private…
Darth.Vader
  • 5,079
  • 7
  • 50
  • 90
1
vote
2 answers

What's going on in this Guice example?

I've got the following code example. public interface Calculator { public int compute(int a); } public class Adder implements Calculator { private int n = 0; @Override public int compute(int a) { int result = a + n; …
matanc1
  • 6,525
  • 6
  • 37
  • 57
1
vote
1 answer

Override binding or child module in Guice

Im writing a component using Google Guice that lives next to a web application that does not use any dependency injection tool. The Guice Module in the component has a few "fixed" bindings that will not change and a couple that are dynamic since…
margabit
  • 2,924
  • 18
  • 24
1
vote
2 answers

Is it possible to elegantly provide instances from Guice assisted injected factories that contain no arguments or equivalent?

Okay, so the following code fails. However, if there are multiple potential instances of View, then injecting lots of Provider providers where you want to use them feels clumsy. It may be that this is feasible in my case, however I can imagine that…
Daniel Gerson
  • 2,159
  • 1
  • 19
  • 29
1
vote
1 answer

Guice - Field Injection limitations

Suppose that we have a class, called Bean, that depends on another class, called Service, using Fields Injection and we can’t change the code of these classes. Another class (App) uses a Provider in order to construct new instances of the Bean…
Alex
  • 83
  • 1
  • 11