Hey folks,
I'm just getting started with Guice (and DI in general). I have a
question, hope it's not too dense.
I have a method that looks something like this in its first
incarnation (_predictors is a collection):
public boolean dispatch()
{
for( PredictorProfile predictor : _p
public DispatchHandler newInstance(PredictorProfile predictor) {
>> return new DispatchHandler(predictor, d1, ...);
>> }
>> }
>> }
>>
>> You could also use "Builder" instead of "Factory" depending on how you
>> structure
ings to
> be immutable myself.
>
> Bob
>
> On Thu, Oct 16, 2008 at 9:24 AM, Andrew Clegg <[EMAIL PROTECTED]>
> wrote:
>>
>> Okay... You took me by surprise a bit, I was expecting something based
>> on Provider. Like injecting a
>> Provider as one of the a
2008/10/16 Bob Lee <[EMAIL PROTECTED]>:
> That looks fine to me. You've effectively inverted the design, turning
> DispatchHandler into a thread factory.
Great, that's roughly how I was intending it to begin with, hence not
wanting another level of indirection in there really.
Nice one for putt
. Hope it helps.
>
> Cheers,
> Alen
>
> On 20 okt., 13:04, "Andrew Clegg" <[EMAIL PROTECTED]> wrote:
>> Morning folks,
>>
>> I have a custom provider for creating SoapDispatchHandler objects,
>> which implement an interface called DispatchH
gt;
>>
>> > I don't think you shuld be conserning yourself with binding provider
>> > directly.
>>
>> > bind(DispatchHandler.class).toProvider(SoapDispatchHandlerProvider.class);
>>
>> > now if you do
>>
>> > @Inject
>> &g
Morning folks,
I have a custom provider for creating SoapDispatchHandler objects,
which implement an interface called DispatchHandler.
I want to set up a binding in my module such that any reference to
Provider is injected with an instance of
SoapDispatchHandlerProvider, the provider class which
Yep, working fine now, thanks Alen. This is my second week of Guice,
expect more silly questions :-)
2008/10/20 Andrew Clegg <[EMAIL PROTECTED]>:
> Aah! I didn't realise you could do that. I thought providers just
> worked like this:
>
> // module
> bind(
Maybe I'm doing something stupid, but what's wrong with this picture:
// In my module RealServicesModule
bind( String.class ).annotatedWith(
FuncNetVersionDependent.class ).toInstance(
"http://cathdb.info/FuncNet_0_1/"; );
// A static member in my test class
@Inject @FuncNetVersi
PS This is using old-skool Guice 1.0 release, I'm hesitant to upgrade
while I'm still learning, but if this is a known issue then I can...
Cheers.
Andrew.
2008/10/28 Andrew Clegg <[EMAIL PROTECTED]>:
> Maybe I'm doing something stupid, but what's wrong with this p
2008/10/28 Robbie Vanbrabant <[EMAIL PROTECTED]>:
> You have to create the injector @BeforeClass gets called, and you need to
You mean initialize it as a static member itself or something?
private static Injector injector = Guice.createInjector( new
RealServicesModule() );
Then do the @BeforeCl
As another complete beginner (to dependency injection in general) I
found the book really useful:
http://books.google.com/books?id=0A0v45fHtHcC
Andrew.
2008/11/29 Pierre8r <[EMAIL PROTECTED]>:
>
> Hello,
>
> Where to find some examples programs for great beginner ?
>
> Thanks,
>
> Pierre8r
>
>
Morning folks, just FYI:
I accidentally bound an interface to an abstract class (forgot to
un-abstract it after some refactoring) and got an NPE in
BindingBuilderImpl$FactoryProxy:
com.google.inject.ProvisionException: Error while locating instance
bound to info.cathdb.funcnet_0_1.sessiondb.Re
2008/12/5 Stuart McCulloch <[EMAIL PROTECTED]>:
>
> FYI, according to the issues list it has been fixed:
>
> http://code.google.com/p/google-guice/issues/detail?id=184
Whoops, my bad for not checking. Thanks.
Andrew.
--~--~-~--~~~---~--~~
You received this mess
You can do this by binding List references annotated with
a particular marker annotation to a specific implementation of
List, which preloads itself with the required elements.
e.g. Set up annotations called @FileMenu, @EditMenu ... and Guice can
look for these and bind to the right preload
annotated with the appropriate annotations.
Or I might have completely misunderstood the problem :-)
Andrew.
2009/1/14 Andrew Clegg :
> Are GuiSqlMapClientProvider and NdaSqlMapClientProvider supposed to be
> singletons? You might want to try something like toInstance() method
> describ
2009/1/14 Rick :
> The problem(?) is that SqlMapClient.class is an object I don't have control
> of it's an iBATIS class that just needs a config file sent to it. Different
> DAOs I use (just two for instance) need a different load of that
> SqlMapClient class. That's waht the provider was doing
2009/1/14 Rick :
> I see, use a Module class instead of a Provider? I never thought of that.
> That's where I was getting stumped - "where to do that work that initializes
> the sqlMapClient instance that I'll need." I didn't think Modules were for
> that sort of thing, but it looks pretty clean.
Hi,
Does anyone know why I can't post to this group from a secondary,
non-gmail email address?
Google is aware that the address belongs to my account, because it
shows as a secondary address here
https://www.google.com/accounts/EditUserInfo and here
https://www.google.com/accounts/EditUserInfo .
2009/1/14 Rick :
> I don't think google groups allow posting to them from a non gmail address.
There were some last month from someone at @nrc-cnrc.gc.ca ...
Andrew.
--
New site launched: http://biotext.org.uk/
I am retiring my old email addresses.
Please use firstn...@nervechannel.com where
2009/1/14 Putrycz, Erik :
>
> Yes you just need to register your email as google account.
Hmm, having tried various combinations, the only way to make it work
if you're actually *using* gmail to send mail from your non-gmail
address, is to subscribe both accounts to the list. Otherwise it
thinks
2009/1/14 Rick :
> Thanks Andrew! This worked perfectly. I owe you one.
No probs :-)
> Truthfully, I think this concept of using a Module to instantiate more than
> one of the same type of object should be emphasized more in the docs, or
> maybe in the wiki. I guess if you think of the Module
2009/1/14 Rick :
> I'm curious, I like the fact that you can use annotations, but if you
> annotate your interfaces with @ImplementedBy aren't you breaking the whole
> concept of DI? I would think the point of using a DI framework is that if I
> wanted I could quickly swap out the implementations
2009/1/14 Robbie Vanbrabant :
> I think the more elegant solution (Guice 2.0) would be to use private
> modules:
> http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/PrivateModule.html
How stable is Guice 2.0? Is there an estimated release date?
> Avoiding work in modu
Simple answer: Stick to constructor injection. Then when the
constructor actually starts running, you know all the injection is
done.
2009/1/16 Kamran :
>
> Is it possible to call some method after an object is completely
> injected with dependencies? At the moment I have to explicitly call
> the
Hi folks, I'm looking for a bit of advice here...
I'm building a JAX-WS Provider web service using the CXF toolkit. The
Provider class is created 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
PS I'm still using Guice 1.0 but I'm happy to upgrade if nearly-2.0
makes this easier...
2009/2/6 Andrew Clegg :
> Hi folks, I'm looking for a bit of advice here...
>
> I'm building a JAX-WS Provider web service using the CXF toolkit. The
> Provider class is cre
but it
doesn't do much so it doesn't really need to be. And the real web
service provider can be tested with mocked-out dependencies without
using Guice.
If anyone has a better solution I'd be happy to hear it, but this
seems to work pretty well.
Andrew.
2009/2/6 Andrew Clegg :
>
28 matches
Mail list logo