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
3
votes
2 answers

Is guice 4.0 backwards compatible with 3.x?

Is guice 4.0 backwards compatible with 3.x? Cannot figure it out from the release-notes or FAQ... If not, is there a list of compatibility issues somewhere?
Rop
  • 3,359
  • 3
  • 38
  • 59
3
votes
1 answer

How to mock an Authenticator in play framework with guice injections?

I have a play application with authenticated routes. I implemented an Authenticator, storing users into elasticsearch. My securized methods in my controllers are annotated with the @Security.Authenticated annotation. For my unit tests with mockito,…
Thibaut M.
  • 299
  • 1
  • 2
  • 10
3
votes
2 answers

Guice - create binding to java.lang.class

Is there any slick way (if any) for Guice to somehow bind a class type to an interface? I don't mean an instance of the class, but the actual java.lang.class type itself. i.e. (obviously doesn't work, but tells what I'm…
3
votes
2 answers

Guice Assisted Inject is ignored?

I've installed a factory in Google Guice with AssistedInject, but I get the following error (I'm running unit tests with JUnit): com.google.inject.CreationException: Guice creation errors: 1) No implementation for…
sinθ
  • 11,093
  • 25
  • 85
  • 121
3
votes
2 answers

Dynamic dependency injection

I want to achieve DYNAMIC dependency injection. Does GUICE support this? If not could you recommend any other DI framework? The implementation that should be used for injection via @Inject must be determined during runtime e.g. via interaction with…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
3
votes
1 answer

Using Assisted Inject with FactoryModuleBuilder in guice - Factory injection not being done

I am a guice newbie trying to figure out how to implement assisted inject in the guice using FactoryModuleBuilder. I consulted the guice java docs for implementing FactoryModuleBuilder. I have done everything exactly as it says in the docs. Its not…
sachi1325
  • 45
  • 1
  • 6
2
votes
1 answer

Proper structure for dependency injection (using Guice)

I would like some suggestions and feedback on the best way to structure dependency injection for a system with the structure described below. I'm using Guice and thus would prefer solutions centered around it's annotation-based declarations, not…
David B.
  • 5,700
  • 5
  • 31
  • 52
2
votes
1 answer

Guice Assisted : No implementation for java.lang.String annotated with @com.google.inject.assistedinject.Assisted(value=prefix) was bound

I've done this a million of times, but right now it's not working and I don't know why ! I've my interface that defines the contract of the Writers like : public interface Writer { void exit() throws IOException; void write(String row)…
flywell
  • 384
  • 3
  • 20
2
votes
0 answers

Guice 3.0 default provider implementation

I've been using Guice on project, and I'm trying to understand how the default injected providers work. In the "Injecting Providers" section of the manual (https://github.com/google/guice/wiki/InjectingProviders) there's the following simple…
2
votes
1 answer

Using a WebService with Akka Actors and the play framework

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:…
2
votes
1 answer

Spring bean to google guice conversion

Below snippet is taken from here. My question is how can I have this binding in Guice.
big
  • 1,888
  • 7
  • 28
  • 48
2
votes
2 answers

Unable to use serenity-cucumber (aka thucydides-cucumber) along with cucumber-guice

I've created Cucumber test project and successfully configured Guice support by cucumber-guice. When I've added serenity-cucmber and configure test runner with CucumberWithSerenity I've got an error: More than one Cucumber ObjectFactory was found in…
GreenTeaCake
  • 848
  • 10
  • 17
2
votes
1 answer

How to make Guice MapBinder really typesafe?

Here is how my StatusMapper interface looks like: public interface StatusMapper { Status map(final T exception); } And here is my MapBinder: TypeLiteral> exceptionType = new…
Mike Mitterer
  • 6,810
  • 4
  • 41
  • 62
2
votes
1 answer

TransactionRequiredException: no transaction is in progress with Jersey + Guice + JPA

Using Guice 3.0, following this tutorial: https://code.google.com/p/google-guice/wiki/JPA GuiceModule class: public class GuiceModule extends ServletModule { @Override protected void configureServlets() { // start the service …
AndresQ
  • 803
  • 5
  • 19
2
votes
1 answer

How can we bind method interceptors requiring assisted injection in guice?

I have a class (WindowedCounter) which is creating using assisted injection. I need to inject a factory for this class into a method interceptor. Now a method interceptor can only be bound to a concrete instance. So my question is how to do this…
Usman Ismail
  • 17,999
  • 14
  • 83
  • 165