guice Questions

3

Solved

How to test implementations of Guice AbstractModule in a big project without creating fake implementations? Is it possible to test bind() and inject() methods?
Marcellus asked 3/11, 2014 at 8:14

3

Solved

I've a Kotlin project which uses Guice for DI and has recently been updated from JDK 8 -> 11. It now emits the following error at runtime: WARNING: An illegal reflective access operation has occur...
Coper asked 30/9, 2019 at 10:27

6

Solved

I have a factory as below, public final class Application { private static IFoo foo; public static IFoo getFoo(String bar) { // i need to inject bar to the constructor of Foo // obvious i ...
Kenogenesis asked 11/2, 2012 at 5:12

3

I am trying to @Inject a Guice service into a @ServerEndpoint. I am using Tomcat 8.0.15 as the JSR-356 implementation. However, the dependency injection isn't working. Is there any additional confi...
Dawdle asked 16/12, 2014 at 7:43

2

I am trying, using Jersey & Google Guice 3.0, to map 2 different URL patterns to the same servlet and each of these URL patterns to be applied to a different package in my project. To be clear...
Consultative asked 15/5, 2013 at 15:18

2

Solved

I'm trying to figure out how to Singleton bind a servlet for my code: public class GuiceServletModule extends ServletModule { @Override protected void configureServlets() { Map<String, Strin...
Fluorinate asked 11/2, 2015 at 7:59

3

Solved

I would like to use goolge/guice inject a value based on a class i provide with the annotation. AutoConfig annotation @BindingAnnotation @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType....
Ploy asked 16/2, 2015 at 20:13

2

Solved

Suppose I have two modules ModuleA and ModuleB which are self-sufficient and can be used as stand-alone modules. Both the modules have a dependency on a third module ModuleC like install(new Modu...
Fifield asked 5/12, 2016 at 13:26

2

I'm new to lombok and guice injection, I could get the general concept but I ran into some code which I don't understand and can't search due to the syntax. Following is the code, can someone help ...
Gamo asked 20/3, 2017 at 17:27

2

I want to write functional test for my controller in PlayFramework. To do that I want to mock implementation of some classes. I found nice example of how to do that using spec2 here: http://www.in...
Paolapaolina asked 2/9, 2015 at 21:44

2

Solved

I have a module in my class called MainModule. It has various bindings in it, one of which is a binding to my custom service interface called HttpClientPool public class MainModule extends Abstrac...
Jacintojack asked 12/12, 2014 at 22:54

4

Is there any possibility using a framework for enabling / using Dependency Injection in a Spark Application? Is it possible to use Guice, for instance? If so, is there any documentation, or sampl...
Tonsillotomy asked 19/11, 2017 at 20:1

5

I have started to use Guice method-level transactions like described here. I have a message like @Inject private EntityManager entityManager; @Transactional public UserSession createSession(User ...
Marlanamarlane asked 31/12, 2012 at 1:31

2

Solved

I have been trying to get Guice working but end up with this: Classes must have either one (and only one) constructor My interface: public interface AddrBookStore { public Contact getContact...
Maculate asked 28/6, 2016 at 18:12

5

Solved

Please provide some basic information of how TypeLiteral in Google Guice or Java EE is used, It will be very helpful if it would be explained using a simple code, thanks in advance
Vespid asked 28/12, 2011 at 12:27

5

Solved

I have an annotation @MyAnnotation and I can annotate any type (class) with it. Then I have a class called AnnotatedClassRegister and I would like it to register all classes annotated with @MyAnnot...
Garfish asked 4/5, 2011 at 21:18

3

Solved

With Spring, you can define an array property and have Spring inject one of every (@Component) class that derives from the given type. Is there an equivalent for this in Guice? Or an extension poi...
Mortician asked 22/5, 2011 at 0:3

4

If I have interface Validator and multiple implementations for this interface. How can I inject any of the multiple implementations with Guice? Now I know that I can use following code to inject on...
Rakish asked 8/11, 2011 at 6:41

3

Solved

Using Guice, if I have @Inject @Named("light") Color light; I can use bind(Color.class).annotatedWith(Names.named("light")) .toInstance(new Color("white")); to bind it to white color if Col...
Arteriosclerosis asked 5/9, 2012 at 21:37

2

Solved

I would like to scope objects so that they exist as singletons for the duration of a unit test. The pattern would follow the @RequestScoped and @SessionScoped already implemented in Google Guice, b...
Underlet asked 7/9, 2015 at 19:4

3

I want to enable a custom jackson deserializer of some fields of type String. The deserializer also needs to be injected with a guice based dependency bean. SampleCode below: public class CustomDe...
Federalese asked 20/2, 2019 at 1:44

7

I have a plain jane servlets web application, and some of my classes have the following annotations: @Controller @RequestMapping(name = "/blog/") public class TestController { .. } Now when my ...
Analogical asked 29/10, 2012 at 19:48

4

I have a JavaFX application where I would like to introduce Guice because my Code is full of factorys right now, only for the purpose of testing. I have one use case where i have a controller clas...
Pollack asked 5/5, 2014 at 11:19

2

I am extending Guice's AbstractModule and inside of the extending class I need access to Guice's injector. It that possible, if yes, how?
Undone asked 13/4, 2013 at 16:21

4

I am using Play with Scala and I am trying to create a singleton, and i want to inject it from its trait and not directly. for example: @ImplementedBy(classOf[S3RepositoryImpl]) trait S3Repositor...
Hulse asked 17/2, 2016 at 12:50

© 2022 - 2024 — McMap. All rights reserved.