Dependencies

2015-09-10 Thread Michiel ten Hagen
All I have two classes, Cache and CacheMonitor. If someone binds the Cache I want the CacheMonitor to be initiated. Currently I have the Cache class depend on the CacheMonitor but this creates a unnecassary dependency, the Cache should be able to be used without the CacheMonitor. Is there a

Circular dependencies

2009-10-30 Thread christopher.oestl...@gmail.com
Is there any way to turn of the feature that resolves circular dependencies? At least for me it's easy to just inject stuff and after a while things explode in a circular dependency that is hard to track down, I still have a hard time tracking it down even with the nice detailed excepti

Re: Dependencies

2015-09-10 Thread Nate Bauernfeind
Maybe you want to make CacheMonitor an optional dependency? See: https://github.com/google/guice/wiki/Injections#optional-injections On Thu, Sep 10, 2015 at 7:00 AM Michiel ten Hagen wrote: > All > > I have two classes, Cache and CacheMonitor. If someone binds the Cache I > want the CacheMonit

Re: Dependencies

2015-09-10 Thread Fred Faber
An idiomatic solution is to create a CacheModule which you would ask clients of Cache to install. Within the module you would: 1. create the binding for Cache 2. add any additional logic for your CacheMonitor Not knowing anything about either of these classes it's difficult to say what (2

On circular dependencies

2009-03-19 Thread Jonathan
Looking over the way Guice handles circular dependencies, it looks like the resulting object for some expected type is inserted into each of the delegating proxies that were created as a result of a circular dependency. I know this is just one solution to a nasty problem, but I was hoping to find

Re: Circular dependencies

2009-11-02 Thread Endre Stølsvik
I'll just chime in here with nothing except my support: Hear hear! Endre. On Fri, Oct 30, 2009 at 09:48, christopher.oestl...@gmail.com < christopher.oestl...@gmail.com> wrote: > > Is there any way to turn of the feature that resolves circular > dependencies? > > At

Re: Circular dependencies

2009-11-02 Thread Stuart McCulloch
2009/10/30 christopher.oestl...@gmail.com > > Is there any way to turn of the feature that resolves circular > dependencies? > perhaps you could open a feature request over at: http://code.google.com/p/google-guice/issues/list then people could vote on it by starring the iss

Re: Circular dependencies

2009-11-02 Thread Bob Lee
pher.oestl...@gmail.com < christopher.oestl...@gmail.com> wrote: > > Is there any way to turn of the feature that resolves circular > dependencies? > > At least for me it's easy to just inject stuff and after a while > things explode in a circular dependency that is hard to track down, I

graphing binding dependencies

2014-10-03 Thread Kevin Burton
on startup it would be nice to graph the dependencies of a daemon so I can see what the injection looks like. I noticed there was a GraphViz module... But this requires the Linux C binary and I'd like to not have to require packages. IS there a way to render this just with Java to te

Re: On circular dependencies

2009-03-19 Thread Bob Lee
> Looking over the way Guice handles circular dependencies, it looks > like the resulting object for some expected type is inserted into each > of the delegating proxies that were created as a result of a circular > dependency. I know this is just one solution to a nasty problem, but

Re: On circular dependencies

2009-03-19 Thread Sam Berlin
Perhaps if circular dependencies are disabled, then a new @AllowCircular annotation can be added to explicitly enable circular dependencies (on certain parameters) so that they can be allowed on a case-by-case basis. As much as I dislike circular dependencies, sometimes they're incredibly

Re: On circular dependencies

2009-03-19 Thread Jonathan
; move the dep into an injected method instead (not currently supported). > > Bob > > On Thu, Mar 19, 2009 at 5:18 PM, Jonathan wrote: > > > Looking over the way Guice handles circular dependencies, it looks > > like the resulting object for some expected type is inserted i

Re: On circular dependencies

2009-03-19 Thread Endre Stølsvik
On Fri, Mar 20, 2009 at 01:32, Bob Lee wrote: > I assume you're talking about circular deps between constructors. This is a > tough problem. Injecting proxies was an experiment that I don't really like > to advertise. Good! But as a user of your tool, one will most certainly be bitten by them a

Re: On circular dependencies

2009-03-23 Thread Stuart McCulloch
2009/3/20 Endre Stølsvik > > On Fri, Mar 20, 2009 at 01:32, Bob Lee wrote: > > I assume you're talking about circular deps between constructors. This is > a > > tough problem. Injecting proxies was an experiment that I don't really > like > > to advertise. > > Good! > > But as a user of your too

Re: On circular dependencies

2009-03-23 Thread Endre Stølsvik
On Mon, Mar 23, 2009 at 19:23, Stuart McCulloch wrote: > 2009/3/20 Endre Stølsvik >> >> On Fri, Mar 20, 2009 at 01:32, Bob Lee wrote: >> > I assume you're talking about circular deps between constructors. This >> > is a >> > tough problem. Injecting proxies was an experiment that I don't really

Re: On circular dependencies

2009-03-23 Thread Stuart McCulloch
2009/3/24 Endre Stølsvik > On Mon, Mar 23, 2009 at 19:23, Stuart McCulloch wrote: > > I would've thought more likely 2.1 (or 2.x) as this wouldn't require a > major > > API change > > Failing to start if proxies would be needed are a kind of invasive API > change, wouldn't you think? I guess thi

Circular dependencies in Guice

2010-10-04 Thread Roman
Hi I have a very strange problem , that no one could explain me. So here is the problem. I have a circular constructor dependency between 2 classes  I have no problems with this dependency in most cases , but there is one environment ( my production environment where it fails with this strange exce

Newbie Question ! - dependencies objects

2011-12-19 Thread Aladdin
Hi , I'm new to the concept of IoC so I hope my question is not funny and I would appreciated that when people answer me provide full code. Now I have an Abstract class called ServiceConsumer. Assuming I have the following Say this is the ServiceConsumer class public abstract class ServiceConsumer

Re: graphing binding dependencies

2014-10-12 Thread Tavian Barnes
tober 2014 17:18:29 UTC-4, Kevin Burton wrote: > > on startup it would be nice to graph the dependencies of a daemon so I can > see what the injection looks like. > > I noticed there was a GraphViz module... > > But this requires the Linux C binary and I'd like to not have

Re: graphing binding dependencies

2014-10-12 Thread Kevin Burton
TC-4, Kevin Burton wrote: >> >> on startup it would be nice to graph the dependencies of a daemon so I >> can see what the injection looks like. >> >> I noticed there was a GraphViz module... >> >> But this requires the Linux C binary and I'd like to not

Re: graphing binding dependencies

2014-10-13 Thread Brian Pontarelli
fairly > difficult and it's easier to rely on GraphViz to do it. And a complicated > hierarchy would be hard to read from the console. > > On Friday, 3 October 2014 17:18:29 UTC-4, Kevin Burton wrote: > on startup it would be nice to graph the dependencies of a daemon so I

Tests for required dependencies?

2014-10-16 Thread Kevin Burton
Is there an easy way to require that your dependencies are met without actually having to call getInstance or have an instance of an object? This should be easy since I can build a graph of the connections between Classes. Some of my instances require complex init and external dependencies

How to manage modular dependencies?

2010-01-18 Thread Drink Guice
In my application, I have 3 modules - A, B, and C. Module A is independent of any other modules. This is easy to develop and test. However, modules B and C depends on some services from module A. Modules B and C do not depend on each other. What is the best way to handle modular dependencies among

Re: Circular dependencies in Guice

2010-10-04 Thread Philippe Beaudoin
Maybe a stupid answer, but have you tried injecting a Provider<> in one of the two classes, instead of directly injecting the class? Philippe On Mon, Oct 4, 2010 at 10:44 AM, Roman wrote: > Hi > I have a very strange problem , that no one could explain me. > So here is the problem. I have a c

Re: Newbie Question ! - dependencies objects

2011-12-20 Thread scott
Can't say I completely understand the object graph you're trying to create, sounds essentially like ServiceConsumers can depend on other ServiceConsumers. I personally prefer using constructor injection, and putting @Inject on a method like getDependencies() seems weird to me, especially since it'

Re: Newbie Question ! - dependencies objects

2011-12-20 Thread SandMan
Agree with Scott on both the concerns and the implementation. If your next question is going to be, "but I don't know if it's one or more of the dependent objects inside the parent", use Providers. I am assuming either the parent 'serviceconsumer' or some other objec

Re: Newbie Question ! - dependencies objects

2011-12-21 Thread Thomas Broyer
As others, I'm not sure I understood your problem, but maybe you're looking for the multibindings extension : MultiBinder multi = Multibinder.newSetBinder(binder(), ServiceConsumer.class); multi.addBinding().to(CustomerAccountsServiceCon

Re: Newbie Question ! - dependencies objects

2012-01-08 Thread Aladdin
Thank you all for the great replies, I wanted to use IoC concept to avoid having dependencies hard-coded in my class (at least this what I thought). Having something like : CustomerServiceConsumer(CustomerAccountsServiceConsumer accountConsumer, CustomerCreditCardsServiceConsumer

Re: Newbie Question ! - dependencies objects

2012-01-08 Thread Thomas Broyer
On Sunday, January 8, 2012 7:08:21 AM UTC+1, Aladdin wrote: > > @Thomas I think you MultiBinder is what I need but I'm using GIN and > it's not supported :( > > > Any other suggestions ? Could possibly be as simple as (in your GinModule): @Provides Set> provideServiceConsumers(CustomerAccou

Re: Newbie Question ! - dependencies objects

2012-01-08 Thread Sam Berlin
On Sun, Jan 8, 2012 at 11:24 AM, Thomas Broyer wrote: > > > On Sunday, January 8, 2012 7:08:21 AM UTC+1, Aladdin wrote: >> >> @Thomas I think you MultiBinder is what I need but I'm using GIN and >> it's not supported :( >> >> >> Any other suggestions ? > > > Could possibly be as simple as (in you

methodInterceptor not resolving it dependencies

2012-11-15 Thread transmeta01
I have a method interceptor that has a number of dependencies (all guice managed objects), as explained in http://code.google.com/p/google-guice/wiki/AOP the use of requestInjection should have guice inject the dependencies auto-magically. But, when the interceptor is called, all the

Optional dependencies and default values

2014-06-27 Thread Edgar Espina
Hi, I'm using Guice to inject HTTP Request parameters (I'm not using guice-servlet) and I will like to do things like: public class Command { > public Command(@Named("name") String name) { > } > } Here "name" is an HTTP parameter and I'm able to bind it when present. The problem (of co

Re: Tests for required dependencies?

2014-10-16 Thread Sam Berlin
If you don't inject the injector anyway, wouldn't creating the injector (in Stage.TOOL if you want to prevent creating anything) cover this? sam On Thu, Oct 16, 2014 at 2:00 PM, Kevin Burton wrote: > Is there an easy way to require that your dependencies are met without > ac

Re: Tests for required dependencies?

2014-10-16 Thread Kevin Burton
; > sam > > On Thu, Oct 16, 2014 at 2:00 PM, Kevin Burton > wrote: > >> Is there an easy way to require that your dependencies are met without >> actually having to call getInstance or have an instance of an object? >> >> This should be easy since I can

Re: Tests for required dependencies?

2014-10-16 Thread Sam Berlin
So long as you have no code that has @Inject Injector (and then later calls .getInstance(Something.class), because Guice can't statically detect that), then calling Guice.createInjector(MyModule(), Stage.TOOL) should fail if you're missing dependencies. sam On Thu, Oct 16, 2014 at 3:31

Re: Tests for required dependencies?

2014-10-16 Thread Kevin Burton
tect > that), then calling Guice.createInjector(MyModule(), Stage.TOOL) should > fail if you're missing dependencies. > > sam > > On Thu, Oct 16, 2014 at 3:31 PM, Kevin Burton > wrote: > >> I don't follow.. I can't parse your sentence. >> >> O

Best way to replace dependencies ?

2015-01-22 Thread Kevin Burton
Is there a good pattern to *replace* dependencies with new bindings? During our init, I have the need to replace a standard output logger, with a log4j logger... It only needs to happen once. I was thinking of having some sort of ReplaceableProvider that has a set() method and uses an

Inject dependencies when they are avaible

2009-08-16 Thread Norman Maurer
nto the classes. The injection is done in the livecycle and so its only avaible in the class after the livecycle was complete. So at the moment I'm trying to write some kind of bridge between avalon and guice to be able to convert the project step by step. And here comes the problem. Some kind

Re: How to manage modular dependencies?

2010-01-18 Thread Fred Faber
true starting point, and then start the application (e.g., this would start up a http server). Hence it is within your application module that modules A, B, and C will be installed. There should be no lateral dependencies among these, lest an unsortable web of installations be created. For insta

Suggested way of injecting static dependencies

2010-04-27 Thread Patrick Bergner
Hi, I'm new to Guice and lack experience in using it the suggested (intended) way. I already figured out most of what I need to use Guice in a relatively simple application and like it very much but one thing is missing: injecting static dependencies. I need this in classes that contain

Can I lazy-bind @Named dependencies?

2012-05-04 Thread Eric Jain
s/10440756/can-i-lazy-bind-named- dependencies] -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to google-guice@googlegroups.com. To unsubscribe from this group, send email to google-guice+unsubscr...@g

Re: methodInterceptor not resolving it dependencies

2012-11-15 Thread Stephan Classen
how about posting your interceptor code so we can have a look at it? On 11/16/2012 03:13 AM, transmeta01 wrote: I have a method interceptor that has a number of dependencies (all guice managed objects), as explained in http://code.google.com/p/google-guice/wiki/AOP the use of requestInjection

Re: methodInterceptor not resolving it dependencies

2012-11-16 Thread Fred Faber
It'd be helpful if you posted some code, such as where you request injection and what the interceptor looks like. On Nov 15, 2012 9:13 PM, "transmeta01" wrote: > I have a method interceptor that has a number of dependencies (all guice > managed objects), as explained in >

Re: methodInterceptor not resolving it dependencies

2012-11-16 Thread Richard Mutezintare
e. > On Nov 15, 2012 9:13 PM, "transmeta01" wrote: > >> I have a method interceptor that has a number of dependencies (all guice >> managed objects), as explained in >> http://code.google.com/p/google-guice/wiki/AOP >> the use of requestInjection should h

Re: methodInterceptor not resolving it dependencies

2012-11-16 Thread Stuart McCulloch
rname); > > > List findAuditByKeyword(String keyword); > List findAuditByKeyword(String... keywords); > Audit saveAudit(Audit auditToSave); > > > } > > > On Thu, Nov 15, 2012 at 9:35 PM, Fred Faber wrote: > It'd be helpful

Guice dependencies: what are they exactly?

2013-06-27 Thread Francis Galiegue
Hello, I am considering Guice (3.0) for several of my projects and am starting to use it on one in particular. However, its dependencies are quite many. cglib and javax.inject I can understand; aopalliance, OK (tried without it, code doesn't run). But what about the rest? What are their

Re: Optional dependencies and default values

2014-06-27 Thread Stephan Classen
Do you create a new injector (or childinjector) for every request? Am 27.06.2014 22:02 schrieb Edgar Espina :Hi, I'm using Guice to inject HTTP Request parameters (I'm not using guice-servlet) and I will like to do things like:public class Command {  public Command(@Named("name") String name) {  }}

Re: Optional dependencies and default values

2014-06-27 Thread Edgar Espina
child injector per request On Friday, June 27, 2014 5:48:23 PM UTC-3, scl wrote: > > Do you create a new injector (or childinjector) for every request? > Am 27.06.2014 22:02 schrieb Edgar Espina >: > > Hi, > > I'm using Guice to inject HTTP Request parameters (I'm not using > guice-servlet) and

Re: Optional dependencies and default values

2014-06-29 Thread Tim Boudreau
I think @Named is not a good fit for that, for precisely the reasons you specify. Guice has to know the names of things that will be injected ahead of time. There are ways I can think of that you could torture Guice into doing what you're after (if you really want I can describe them), but th

Re: Optional dependencies and default values

2014-06-29 Thread Tim Boudreau
Sorry, the link I meant to include was this: http://timboudreau.com/builds/job/mastfrog-parent/lastSuccessfulBuild/artifact/acteur-modules/acteur-parent/acteur/target/apidocs/com/mastfrog/acteur/preconditions/InjectParametersAsInterface.html -Tim On Sunday, June 29, 2014 5:18:38 AM UTC-4, Tim Bou

Re: Optional dependencies and default values

2014-06-29 Thread Tim Boudreau
On Friday, June 27, 2014 4:50:50 PM UTC-4, Edgar Espina wrote: > > child injector per request As recently discussed in another thread, a custom scope will accomplish that with less overhead. -Tim -- You received this message because you are subscribed to the Google Groups "google-guice" gro

Re: Best way to replace dependencies ?

2015-01-22 Thread Nate Bauernfeind
l Of course, I might completely miss your question. On Thu Jan 22 2015 at 3:55:21 PM Kevin Burton wrote: > Is there a good pattern to *replace* dependencies with new bindings? > > During our init, I have the need to replace a standard output logger, with > a log4j logger... >

Re: Inject dependencies when they are avaible

2009-08-16 Thread Dhanji R. Prasanna
ivecycle was complete. > > So at the moment I'm trying to write some kind of bridge between > avalon and guice to be able to convert the project step by step. And > here comes the problem. Some kind of the "dependencies" are only > avaible after the livecycle was complete (

Re: Inject dependencies when they are avaible

2009-08-16 Thread Norman Maurer
; >> So at the moment I'm trying to write some kind of bridge between >> avalon and guice to be able to convert the project step by step. And >> here comes the problem. Some kind of the "dependencies" are only >> avaible after the livecycle was complete (as

Re: Inject dependencies when they are avaible

2009-08-16 Thread Dhanji R. Prasanna
onvert" it step by step. Avalon use some kind > >> of different livecycles which are used to inject stuff into the > >> classes. The injection is done in the livecycle and so its only > >> avaible in the class after the livecycle was complete. > >> > >

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Willi Schönborn
Patrick Bergner wrote: Hi, I'm new to Guice and lack experience in using it the suggested (intended) way. I already figured out most of what I need to use Guice in a relatively simple application and like it very much but one thing is missing: injecting static dependencies. I need th

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Stuart McCulloch
injecting static dependencies. > > I need this in classes that contain only static methods (a utility > class). For the sake of an example, think of a logger that should be > injected and be usable by the static methods. Let's say it looks like > this: > > public class Uti

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Christian Edward Gruber
art McCulloch wrote: On 27 April 2010 17:44, Patrick Bergner wrote: Hi, I'm new to Guice and lack experience in using it the suggested (intended) way. I already figured out most of what I need to use Guice in a relatively simple application and like it very much but one thing is missing: inj

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Jonathan Abourbih
On 27 Apr 2010, at 10:44, Patrick Bergner wrote: Hi, I'm new to Guice and lack experience in using it the suggested (intended) way. I already figured out most of what I need to use Guice in a relatively simple application and like it very much but one thing is missing: injecting static depend

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Patrick Bergner
Thanks for your replies. They give me some idea of the "Guice way". I'll make the utilities non-static and let Guice create the instance for me. Now, if you don't mind, give me a hint on this one: I have a Settings object that is a wrapper for a settings.xml file. I instantiate it using Guice. As

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Sam Berlin
Let me repeat the problem to see if I understand it. You a) Have some kind of SettingsXmlReader class that reads an XML file and requires dependencies from Guice passed to its constructor (or parameter methods). b) Need to also tell Guice to bind the result of some of SettingsXmlReader&#

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Patrick Bergner
Thanks for your reply, Sam. With (a) you're absolutely right. However, I'm not sure if I understood (b) correctly. From the way I understood it the answer would be that that's not what I need. Let my try to explain SettingsXmlReader a bit better: (i) SettingsXmlReader has depe

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Christian Edward Gruber
elatively simple application and like it very much but one thing is missing: injecting static dependencies. I need this in classes that contain only static methods (a utility class). For the sake of an example, think of a logger that should be injected and be usable by the static methods. Let

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Sam Berlin
uld only ever inject their direct dependencies. In this case, SettingsXmlReader isn't really a dependency -- it's just a stop on the way to the right dependency. Let's say getXYZ returns a Map -- you can add a @Provides Map xyz(SettingsXmlReader sxr) { return sxr.getXYZ() } to

Re: Suggested way of injecting static dependencies

2010-04-27 Thread Patrick Bergner
Thanks, Sam. Now I got your first explanation as well. Great people around here! :-) -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to google-gu...@googlegroups.com. To unsubscribe from this group, send email

How to demonstrate all dependencies are satisfied

2010-05-25 Thread AB
I am looking for some way to demonstrate, perhaps at test time or app startup, that all dependencies are satisfied with bindings. Once could of course do this will a complete set of functional tests that exersize every part of the system but I am looking for something that runs faster and doesnt

Re: Can I lazy-bind @Named dependencies?

2012-05-10 Thread Alen Vrečko
> @Named dependency is not found? > > I could then look up missing bindings in the application's > configuration file at runtime; otherwise I'd need to pre-bind all > properties as Strings. > > [http://stackoverflow.com/questions/10440756/can-i-lazy-bind-named- > dependenci

Re: Can I lazy-bind @Named dependencies?

2012-05-10 Thread Eric Jain
On Thu, May 10, 2012 at 10:09 AM, Alen Vrečko wrote: > It is design decision of Guice not to support this kind of behavior. > See http://code.google.com/p/google-guice/issues/detail?id=49. > > There is no reason not to bind all properties at start up. You can > then fail early if you mistyped the

Re: Guice dependencies: what are they exactly?

2013-06-27 Thread Stuart McCulloch
On 27 Jun 2013, at 16:07, Francis Galiegue wrote: > Hello, > > I am considering Guice (3.0) for several of my projects and am starting to > use it on one in particular. However, its dependencies are quite many. > > cglib and javax.inject I can understand; aopalliance, OK

Re: Guice dependencies: what are they exactly?

2013-06-27 Thread Sam Berlin
Using Guice has no dependencies other than javax.inject. Compiling Guice has a few more dependencies, but just cglib & aopalliance. The extensions each have their own dependencies. Where are you finding that Guice has more dependencies? sam On Thu, Jun 27, 2013 at 11:07 AM, Francis Gali

Re: Guice dependencies: what are they exactly?

2013-06-27 Thread Francis Galiegue
Hello, On Thu, Jun 27, 2013 at 5:15 PM, Stuart McCulloch wrote: > On 27 Jun 2013, at 16:07, Francis Galiegue wrote: > > Hello, > > I am considering Guice (3.0) for several of my projects and am starting to > use it on one in particular. However, its dependencies are quite m

Re: Guice dependencies: what are they exactly?

2013-06-27 Thread Stuart McCulloch
On 27 Jun 2013, at 16:15, Stuart McCulloch wrote: > On 27 Jun 2013, at 16:07, Francis Galiegue wrote: > >> Hello, >> >> I am considering Guice (3.0) for several of my projects and am starting to >> use it on one in particular. However, its dependencies ar

Correct way to inject dependencies into web service

2009-02-06 Thread Andrew Clegg
rovider in this message, I mean a JAX-WS Provider (http://java.sun.com/javase/6/docs/api/javax/xml/ws/Provider.html) not a Guice Provider. Now, the Provider has various dependencies (handlers for different SOAP operations) which I want Guice to inject as they in turn contain lots of other injectable

Re: How to demonstrate all dependencies are satisfied

2010-05-25 Thread Dhanji R. Prasanna
If you create the injector in Stage.TOOL and requireExplicitBindings() that should be enough to assert everything is bound properly. Dhanji. On Wed, May 19, 2010 at 1:02 PM, AB wrote: > I am looking for some way to demonstrate, perhaps at test time or app > startup, that all dependenci

Re: How to demonstrate all dependencies are satisfied

2010-05-27 Thread AB
>From my coworker: I played around with it this morning and unfortunately the requireExplicitBindings() stuff is not yet released. (Also, from the documentation of Stage.TOOL it's not clear how or why this would actually work since the resulting injector can only be queried for metadata and is not

Re: Correct way to inject dependencies into web service

2009-02-06 Thread Andrew Clegg
ated by CXF (actually via Spring but I don't use > Spring myself) via a no-arg constructor on starting the application. > NB When I say Provider in this message, I mean a JAX-WS Provider > (http://java.sun.com/javase/6/docs/api/javax/xml/ws/Provider.html) not > a Guice Provide

Re: Correct way to inject dependencies into web service

2009-02-09 Thread Andrew Clegg
27; web service implementation, with dependencies supplied via constructor injection. Then any web service calls to the facade's invoke() method are just passed straight through to the real object which it keeps a reference to. This means that the facade isn't really testable in isolation,

How to inject dependencies when creating objects via reflection..

2009-05-21 Thread Jigar Gosar
* How Injecting dependencies when creating "objects" via reflection and the "object" also has a constructor parameters. * details: I have a Hierachy (tree) of classes. class Base{ Base(String s){...} } class Child1{ Child1(String s){super(s)} } class Child2{

custom scope is ignored for classes with no dependencies

2009-06-02 Thread Dmitry Skavish
ChildScoped. If a component has injectable dependencies (has constructor with Inject and with parameters) then it all works as it should, the components are created in a child injector and added to the scope. The problem starts if a components (annotated with ChildScope) has constructor with no

Re: How to inject dependencies when creating objects via reflection..

2009-05-21 Thread David Stenglein
Jigar, AssistedInject allows you to have a single factory interface for creating all of your instances, even if they have different dependencies in the constructor arguments. As long as the other arguments can be supplied through Injection, it doesn't matter how many there are; there just

Re: How to inject dependencies when creating objects via reflection..

2009-05-21 Thread Alen Vrecko
llows you to have a single factory interface for > creating all of your instances, even if they have different > dependencies in the constructor arguments. As long as the other > arguments can be supplied through Injection, it doesn't matter how > many there are; there just needs

Re: How to inject dependencies when creating objects via reflection..

2009-05-21 Thread Jigar Gosar
Cheers, > Alen > > On May 21, 9:00 pm, David Stenglein wrote: >> Jigar, >> >> AssistedInject allows you to have a single factory interface for >> creating all of your instances, even if they have different >> dependencies in the constructor arguments. As

Re: custom scope is ignored for classes with no dependencies

2009-06-02 Thread Sam Berlin
gt; I have root module: RootModule and child module: ChildModule. I create > root injector from RootModule and two child injectors from > ChildModule. Every ChildModule defines its own scope, say ChildScope. > So I annotate some components with ChildScoped. If a component has > injectable

Re: custom scope is ignored for classes with no dependencies

2009-06-02 Thread Dmitry Skavish
I am specifying it in the child module. It does not seem to matter. The only thing which matters is component's dependencies. If they all can be injected from the parent then the component will be created in parent. I believe this is a bug. If I explicitly bind component in a child it shou

Re: custom scope is ignored for classes with no dependencies

2009-06-03 Thread je...@swank.ca
On Jun 2, 2:00 pm, Dmitry Skavish wrote: > I am specifying it in the child module. It does not seem to matter. > The only thing which matters is component's dependencies. If they all > can be injected from the parent then the component will be created in > parent. I believe th

Re: custom scope is ignored for classes with no dependencies

2009-06-03 Thread Dmitry Skavish
ild's bound class and in testChildExplicitScope I explicitly bind the child to the scope. I believe this is bug and not a design decision (correct me if I wrong). Basically whether a child will be scoped or not depends on its dependencies! I already annotated this class with ChildScoped, it shou

Re: custom scope is ignored for classes with no dependencies

2009-06-03 Thread je...@swank.ca
Dmitry, This is indeed a bug. I'm quite sorry about this! Apparently our code that detects misplaced scopes doesn't fire errors when it's supposed to. And the absence of an error means that the binding can be "successfully" created in a parent injector. Oh dear. I've implemented a fix and the co

Re: custom scope is ignored for classes with no dependencies

2009-06-03 Thread Dmitry Skavish
Jesse, thanks for the quick fix! it works as it should now. On Jun 3, 12:53 pm, "je...@swank.ca" wrote: > Dmitry, > > This is indeed a bug. I'm quite sorry about this! Apparently our code > that detects misplaced scopes doesn't fire errors when it's supposed > to. And the absence of an error mea

Creating multiple instances of the same object with different dependencies

2010-03-24 Thread benjipete
I am running into several problems with guice and hoping that someone could help me out. Basically what I want to do is be able to get two different instances of an Object injected with different dependencies. For Example say I have the following two interfaces. public interface GlueApi

Session scoped dependencies and transferring request processing to async thread.

2016-08-02 Thread Anuj Patel
Hi All, I am currently trying to *hack* an approach to use Aysnc Servlet support for Guice 4.1.0 app (along with guice-servlets extension, servlet spec 3.1.0). Most of the things are working just fine but I run into a problem where Sesion scoped deps are not injected/Provider fails with null p

Re: Creating multiple instances of the same object with different dependencies

2010-03-24 Thread je...@swank.ca
Take a look at the Robot Legs problem in the Guice FAQ: How do I build two similar but slightly different trees of objects? This is commonly called the "robot legs" problem: How to create a robot with a two Leg objects, the left one injected with a LeftFoot, and the right one with a Right

Should we rather use singleton injector or try to have all dependencies inserted recursively

2010-04-11 Thread Piotr Sobczyk
We are developing project that uses guice. That's how we have worked until now: If we needed single instance some dependence in class A then we naturally injected it in normal way through constructor or setter: public class A{ private B b; @Inject public A(B b){ this.b = b; }

Inject a sequence of components that implement the same interface and have dependencies themselves

2016-11-07 Thread Dominik
I want to inject a sequence of components where each component implements the same interface. Each of the components may have dependencies themselves which may vary amongst the different implementations of the interface. The actual sequence shall be configurable by the user by means of a

Re: Should we rather use singleton injector or try to have all dependencies inserted recursively

2010-04-11 Thread Willi Schönborn
-managed class (that would require a lot less of work and refactoring from current state of code base). You should never (!!!) need to use the Injector directly. Having it in a static field seems extremly awkward to me. If you really need it somewhere (e.g. dependencies which are only known

Re: Should we rather use singleton injector or try to have all dependencies inserted recursively

2010-04-12 Thread Piotr Sobczyk
Sure it helped! Thanks. I regret that nowwhere in Guice wiki/documentation pdf was I warned that using injectors directly is a wrong thing or a bad practice. I was even encouraged because of a lot of usage Guice.createInjector() in small examples. Or maybe I'm just a very careless reader and overl

Re: Should we rather use singleton injector or try to have all dependencies inserted recursively

2010-04-12 Thread Piotr Sobczyk
We are using integration tests to test data access layer and we decided that it's best to use Guice in this tests. Is it ok to have one Injector shared within test class (initialized in setUp() method) and to operate directly on this Injector in test methods for test needs only? It seems to be the

Re: Inject a sequence of components that implement the same interface and have dependencies themselves

2016-11-08 Thread Stephan Classen
of components where each component implements the same interface. Each of the components may have dependencies themselves which may vary amongst the different implementations of the interface. The actual sequence shall be configurable by the user by means of a