Re: JpaPersistModule, Hibernate and URL Variables

2018-02-14 Thread Sondre Bjornebekk
If you always want to use h2, you could just simply build the string using https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#getenv--? If you wanted to inject different JPA providers, you could certainly use Guice for that (since you posted here) - I have a HibernateSessionFactory

Configuring a GenericServlet (not HttpServlet)

2011-08-15 Thread Sondre Bjornebekk
Hi, I am configuring my servlets with Guice (a joy!), but ran into this little problem: I want to map a GenericServlet (one that extends com.caucho.hessian.server.HessianServlet, so I cannot simply opt for changing it) rather than a HttpServlet. How can I do that? The ServletKeyBindingBuilder

Is a global Injector reference bad practice?

2010-11-04 Thread Sondre Bjornebekk
Hi, Sometimes it can be very convenient to just do injector.getInstance(InjectedObject.class), for instance if you have a object you don't need to be able to mock, but want to send a dependency that you _would_ be like to be able to mock[1]. Currently I do this by setting a global reference to

Re: Is a global Injector reference bad practice?

2010-11-04 Thread Sondre Bjornebekk
for the samples given), though. Thanks. -S- On Nov 4, 9:07 pm, Sondre Bjornebekk sondre.bjorneb...@gmail.com wrote: Hi, Sometimes it can be very convenient to just do injector.getInstance(InjectedObject.class), for instance if you have a object you don't need to be able to mock, but want to send

Re: Parameter based singleton scope in AssistedInject factory?

2010-10-15 Thread Sondre Bjornebekk
, NamedCacheLocal)            .build(Key.get(NamedCache.class, AlwaysCreatesNewInstances.class));     } } That should do the trick. -Fred On Thu, Oct 14, 2010 at 4:25 AM, Sondre Bjornebekk sondre.bjorneb...@gmail.com wrote: Hi, Trying to use assisted inject and find it pretty neat, the minor

Parameter based singleton scope in AssistedInject factory?

2010-10-14 Thread Sondre Bjornebekk
Hi, Trying to use assisted inject and find it pretty neat, the minor detail is that it does not quite work for me yet :-) I have created a Map wrapper to ease switching of caches (typically to something like Coherence) for my application. I want the Map to be returned in a Singleton scope, based