Re: The never-ending beta of Guice 4

2015-03-06 Thread Eelco Hillenius
Second that. It's kind of funny to stay in beta for a couple of years, but come on, there are lots of serious spiky haired people out there who panic when they hear 'beta' ;-) Eelco On Friday, March 6, 2015 at 8:26:05 PM UTC-5, Tim Boudreau wrote: > > Hi, folks, > > I've been using Guice 4 sinc

Re: 4.0 Beta 4 released

2014-03-20 Thread Eelco Hillenius
Happy happy! Eelco On Thursday, March 20, 2014 11:59:37 PM UTC-4, Christian Gruber wrote: > > Greetings guice users, > > We've released Guice 4.0 Beta 4, and the artifacts are now in maven, API > diffs and javadocs freshly generated, code.google.com docs updated, and > you should be able to st

Re: guice / java8

2014-03-19 Thread Eelco Hillenius
Great! Any chance you could give us a ping when that is done? Cheers, Eelco On Wednesday, March 19, 2014 12:31:25 PM UTC-4, Christian Gruber wrote: > > Sam and I will coordinate, and we'll make sure it gets out to Maven > central. > > c. > > On 19 Mar 2014, at 8:10, Thomas Broyer wrote: > > >

Re: Finalizer Memory Leak

2010-03-26 Thread Eelco Hillenius
>This may be a good compromise to exposing a public > shutdown method... I would find that helpful too. It doesn't have to be either/ or either, right? Eelco -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to

Re: bind listener for provider

2010-03-24 Thread Eelco Hillenius
Let me ask this another way. The following test case succeeds: public class ATest { static class A { final B b; A(B b) { this.b = b; } } static class B { } static class AProvider implements Provider { final

bind listener for provider

2010-03-24 Thread Eelco Hillenius
Hi, I'd like to register a type listener for warp-persistence's SessionFactory provider. Which unfortunately is package private, so as a workaround - armed with the knowledge that it is a provider, I thought I'd do this: bindListener(Matchers.only(TypeLiteral.get(Types

Re: injection for module instance binding

2010-03-05 Thread Eelco Hillenius
Bind the class instead of the instance, so that Guice instantiates the object, passing in dependencies in the process. > and GatewayPool: > > public class GatewayPool { >   @Inject >   private GatewaysConfiguration configuration; >    .. >   public GatewayPool { >      configuration.doSomethi

Re: java 6 and guice?

2010-03-05 Thread Eelco Hillenius
> But notice I have to register myResource, would've been nice if it could be > picked up automaticly.. Yeah, mine do get picked up automatically. I guess the debugger is your friend. I also vaguely remember that either servlets or jaxrs resources need to be annotated with @Singleton. Not sure if

Re: java 6 and guice?

2010-03-05 Thread Eelco Hillenius
> SEVERE: service exception: > java.lang.NullPointerException >     at com.netdesign.rest.MyResource.getIt(MyResource.java:58) >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >     at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >     at > sun

Re: java 6 and guice?

2010-03-05 Thread Eelco Hillenius
> com.sun.jersey.server.impl.application.WebApplicationImpl > processRootResources > SEVERE: The ResourceConfig instance does not contain any root resource > classes. Ah yes, I've seen that before. For some funny reason, Jersey refuses to start up if it doesn't find anything to work with in the pa

Re: java 6 and guice?

2010-03-04 Thread Eelco Hillenius
> I'm using a tweaked version of contribs/jersey-guice, part of the > jersey project. See > https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/index.html Here is the an example of code that I use to setup JAXRS/ Jersey with Guice, but you have to read through the fluff a bit sin

Re: java 6 and guice?

2010-03-04 Thread Eelco Hillenius
I'm using a tweaked version of contribs/jersey-guice, part of the jersey project. See https://jersey.dev.java.net/nonav/apidocs/1.1.5/contribs/jersey-guice/index.html Eelco On Thu, Mar 4, 2010 at 5:58 AM, nino martinez wael wrote: > Hi Guys > > First of all thank you for creating guice, it's muc

Re: Help understanding @Inject (doesn't inject unless I use injector.getInstance())

2010-03-02 Thread Eelco Hillenius
> injector = Guice.createInjector(new > TemplateModule.Builder().withSession(new Session()).buildModule(), >   new AbstractModule() { >       �...@override >        public void configure() { >                requestInjection(this); >    }}); This doesn't work because requestInjection(this) request

Re: Help understanding @Inject (doesn't inject unless I use injector.getInstance())

2010-03-02 Thread Eelco Hillenius
> Why is it not injected? Because Guice is not in charge of creating your test class instances. So you either have to explicitly ask it to inject for you, get a reference yourself by using the injector, or use something like AtUnit: http://code.google.com/p/atunit/wiki/SupportedContainers Eelco

Re: Guice with Jdbc

2010-02-28 Thread Eelco Hillenius
> Just curious, when would you not need a transaction? I guess I should say that you don't always want to turn off autocommit (transaction per execution instead of per annotated method). And thinking about it it, maybe there is no good reason. Eelco -- You received this message because you are

Re: Guice with Jdbc

2010-02-28 Thread Eelco Hillenius
> x) I didn't bother with providing support for connection pool, as > Oracle Driver comes with build-in CP sames goes Postgresql If you use e.g. c3po's datasource, you'll get pooling built in but independent of the actual driver. > o) Made a provider for a Connection (I "hardcoded" connection-per

Re: Guice-Persist

2010-02-21 Thread Eelco Hillenius
Yeah, curious about that as well. We're using a snapshot at the moment. How about supporting iBatis? http://code.google.com/p/ibaguice/ looks great, but if it is feasible and all parties agreed, maybe guice-persist could combine the best of warp-persist and ibaguice? Eelco On Sun, Feb 21, 2010 at

Re: DI with Heavy Weight Objects: Initialization and Recovery (or re-init)

2010-02-12 Thread Eelco Hillenius
On Fri, Feb 12, 2010 at 3:56 PM, Sam Berlin wrote: > Is it possible to wrap the 'Connection' around some kind of > 'ManagedConnection' that delegates to the actual Connection and > restablishes the connection if it fails?  That way client code doesn't > have to concern itself with the internals of

Re: DI with Heavy Weight Objects: Initialization and Recovery (or re-init)

2010-02-10 Thread Eelco Hillenius
> This is actually applicable to Socket Producer/Consumers, Database > failovers, etc.., hence the post.  My sense is that implementing > Providers for each heavy weight object is the way to go, using a > Callable in a separate thread to re-connect in the get() method. The > problem of re-establish

Re: Guice + Warp + Hibernate = Session Closed

2010-02-02 Thread Eelco Hillenius
ilter does for servlet requests. *If* you're not in a servlet request, using WorkManager directly is one of the ways you can do it. Eelco On Tue, Feb 2, 2010 at 1:55 PM, Eelco Hillenius wrote: > Keep in mind though, that you want to call beginWork before calling > any @Transactional

Re: Guice + Warp + Hibernate = Session Closed

2010-02-02 Thread Eelco Hillenius
.add((Expression.eq("idApp",app))) >                .add(Expression.ne("isCon", false)) >                .addOrder(Order.desc("priority")); >        return criteria.list(); >         List result = criteria.list(); >        unitOfWork.endWork(); >  

Re: Guice + Warp + Hibernate = Session Closed

2010-02-02 Thread Eelco Hillenius
What is your value for current_session_context_class? If it is managed (which is the value I think is best), then you need to prepare sessions through using WorkManager (beginWork/ endWork, and this is Guice managed, so you can have it injected). Or if you're in a servlet environment, use wideplay'

Re: how to use Guice in serializable context

2010-01-31 Thread Eelco Hillenius
You'd have to either do that - again and again - or use a Wicket-like trick where you abstract re-getting of a value when you deserialize behind a proxy. Eelco On Sun, Jan 31, 2010 at 3:01 PM, Dhanji R. Prasanna wrote: > You're looking for readResolve: > http://java.sun.com/j2se/1.5.0/docs/api/j

Re: Why @Inject?

2010-01-25 Thread Eelco Hillenius
> His article is forgettable, but nobody ever > forgets an open-source flame war. > > Let your community speak for itself, as I'm sure it will.  ;-) Though come on, anything without a bit of arguing every now and then tends to get boring :-) Eelco -- You received this message because you are su

Re: New blog series: from Plexus to Guice

2010-01-25 Thread Eelco Hillenius
> Nice! Does this mean Maven itself will run Guice (from v3)? I was wondering the same. That'd be great, because currently writing Maven plugins requires you to rely on quite a bit of hard-to-track-down magic. Eelco -- You received this message because you are subscribed to the Google Groups "

Re: Configuring two instances of the same class

2010-01-16 Thread Eelco Hillenius
You could use a provider and let it construct the appropriate one using the parameter you get through @Named. You can cache instances with the provider if you want. Eelco 2010/1/16 Willi Schönborn : > On 16/01/2010 18:02, Kartik Kumar wrote: > > This may help. http://code.google.com/p/google-gui

Re: Singleton by default

2010-01-07 Thread Eelco Hillenius
> that. So it is very strange for me that Guice's default scope is > "new". Imho this is a good default because it is the safest one. Being explicit about whether something is a singleton forces developers to think about the consequences. It may also be more efficient for objects that are cheap to

Re: guice without annotations

2009-12-31 Thread Eelco Hillenius
> I have no problem with annotations in general.  Here are my concerns: > - don't want code to depend on guice; jsr would be better here, for > the @Inject; but this issue is minor compared to the others They are annotations, not interfaces. > - 3rd party code (or any code which I can't or should

Spring integration with Guice with interface and implementations separately

2009-10-26 Thread Eelco Hillenius
Hi, I'm looking for advice on how to best integrate Spring with Guice. Basically, I want to be able to use Spring managed modules with Guice managed ones. Guice Spring does that, but the implementation is a bit simplistic. Particularly, the (very typical) case where you'd define the implementing

Re: Can I use Guice to discover all implementations of a type?

2009-10-15 Thread Eelco Hillenius
> Actually, in the end I realised that for my Use Case (Find all implementing > classes for an interface at startup) that a perfectly good solution exists > already in Java 6 - java.util.ServiceLoader. It doesnt require any > additional jars and just does exactly what I want. On reflection I'm not

Re: Can I use Guice to discover all implementations of a type?

2009-10-13 Thread Eelco Hillenius
> If anyone is interested and has the time, it would be great to see a > cleaned up version of this for general use. Heh. Well, I didn't want to bring it up after this thread: http://groups.google.com/group/google-sitebricks/browse_thread/thread/1161c23765621f99/3bcd96cd84b52b86?lnk=gst&q=eelco#3

Re: Can I use Guice to discover all implementations of a type?

2009-10-13 Thread Eelco Hillenius
Unless I missed something obvious, it's such functionality isn't built in. I implemented it myself two weeks ago. Here's the code that does that: http://pastebin.com/f6bff61bc. It isn't pretty in anyway, but it does the job for me. You also need ASM on your classpath (or copied to your own package

Re: How many modules?

2009-09-28 Thread Eelco Hillenius
> I implemented a classpath scanner that reads Guice annotations and > binds eagerly, for the sole purpose of finding such problems either for the sole purpose of finding such problems *early* --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: How many modules?

2009-09-28 Thread Eelco Hillenius
> Therefore I want to start as few modules as possible for some of my unit > tests. This results in many, many small modules. At the moment I have 18 > production modules (and 5 mock modules) for a project with around 300 > classes. > Is this normal? How do you solve that problem? I don't know ab

Re: How to best set up multiple data sources with Guice

2009-09-08 Thread Eelco Hillenius
s, new up the > object and return. > See the second example here: > http://code.google.com/p/google-guice/wiki/ProvidesMethods > > Robbie > > On Tue, Sep 8, 2009 at 11:01 AM, Eelco Hillenius > wrote: >> >> Hi, >> >> I have two different data sources a

How to best set up multiple data sources with Guice

2009-09-08 Thread Eelco Hillenius
Hi, I have two different data sources and I want them initialized through properties files. When using Spring I would just instantiate the same class twice with different parameters, but with Guice it is a little bit less straightforward - at least initially, and in fact I already like the end re