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

Why a filter defined in guice does not listen on /*?

My DI framework is Guice. I also use sitebricks. Perhaps I am fascinated by how simple these two APIs are. However I want to bind a filter, using guice, to listen to /* however the filter only listens on / ? Why is that? public class CoreModule…
Adelin
  • 18,144
  • 26
  • 115
  • 175
1
vote
1 answer

Proper way to do Guice singleton service injection into Quartz tasks, Stripes ActionBeans and ServletContextListeners?

At the moment I'm using a static singleton to obtain the singleton service that Guice 3.0 builds for me through DI - I believe this a terrible hack and not at all the intended way to use Guice for DI, and complicates unit testing. public class…
John M
  • 1,469
  • 17
  • 41
1
vote
1 answer

What is the Guice equivalent to Spring's lookup method?

The Spring lookup method lets you have a method that returns a new instance of an object every time you call it. I read the Guice user guide and didn't see an obvious way of how to do this. I'd like to have some code like this: @Inject private…
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
1
vote
0 answers

Is Guice continuing in progress and consummate enough for enterprise application?

Guice project is not active for a long time, isn't it, what's the situation of Guice? Is Guice3 suitable for enterprise application? Who can tell me?
Xiujun Ma
  • 2,574
  • 1
  • 14
  • 19
1
vote
2 answers

Guice and Akka Actors in Scala

I'd like to reduce the boilerplate needed to bind these akka actors. At current, my code looks like this: bind(classOf[ActorRef]). annotatedWith(Names.named("mines")). toProvider(new TypeLiteral[ActorProvider[MyActor]]() {}). …
Scoobie
  • 1,097
  • 2
  • 12
  • 22
1
vote
1 answer

Guice "Throwing Providers" : How to bind to a type with generics?

Using Guice 3.0, I try to inject a Provider that can throw specific checked exceptions. So I use the Throwing Providers extension. I created an interface for the Provider : public interface IMyProvider extends CheckedProvider { @Override …
electrotype
  • 8,342
  • 11
  • 59
  • 96
0
votes
1 answer

Guice3 Singleton is never instantiated in GAE project

I'm new to Guice and already stuck :) I pretty much copied classes GuiceConfig, OfyFactory and slightly modified Ofy from Motomapia project (which you can browse) using it as s sample. I created GuiceServletContextListener which looks like…
expert
  • 29,290
  • 30
  • 110
  • 214
0
votes
1 answer

Jersey, Guice using non-root request paths

I'm using Jersey 1.11 over Guice 3.0 on Tomcat 6.0.32 in a standard configuration: configureServlets() { filter("/ws/*").through(GuiceContainer.class); } And a simple resource class: @Path("/resource") public class Resource { ... } Given that,…
Laurent Grégoire
  • 4,006
  • 29
  • 52
0
votes
2 answers

Binding a constructor argument based on the Annotation of the class

I have an interface: InterfaceA. I have a class: ConcreteA. I also have two annotations: @AnnotA and @AnnotB. I have done the following…
Basil Musa
  • 8,198
  • 6
  • 64
  • 63
0
votes
0 answers

Guice how to make a property dynamique?

I have this interface classes: public interface Query { String getQuery(); } Query Builder implements Query public class QueryBuilder implements Query { private String query; private final String table; @Inject public…
Nikodev
  • 13
  • 3
0
votes
0 answers

Create multiple providers for same SQS class using Google Guice

I have two SQS queues from which I want to listen to messages using two different message handlers. I am using Guice to bind and initialise the different consumers and message handlers. However, I am unable to bind the respective consumer to…
AYa
  • 421
  • 3
  • 9
  • 21
0
votes
1 answer

GWT - Inject value using Guice @Named

I have Utility class as below. class Utility{ @Inject @Named("endpoint") private String endpoint; //generated only getter } I am configuring value for endpoint in the as below. public class ConfigModule extends AbstractModule { @Override …
Harsh Kanakhara
  • 909
  • 4
  • 13
  • 38
0
votes
1 answer

How can we disable a guice filter at runtime or on application startup?

I have multiple filters defined in my Google guice application. But is there a way I can disable certain filters at runtime or on application startup? bind(MyService.class).to(MyServiceImpl.class); filter("/*").through(MyFilter.class); …
Jaraws
  • 581
  • 1
  • 7
  • 24
0
votes
0 answers

Is there a Way to bind Supplier in google guice?

I tried doing that like below bind(configClass).toProvider(Provider>).in(Singleton.class); But I'm getting this error. no suitable method found for toProvider(com.google.inject.Provider)
0
votes
1 answer

Google Guice trouble overwriting my hashmap for each test

I recently switched over to Google Guice and now my results are being overwritten for each test instead of adding all tests. I am using a hashmap to collect the pass and fails of each test but instead of collecting data for each test it overwrites…
jimbaker
  • 105
  • 2
  • 6