Configuration using Guice

2009-08-11 Thread Max Bowsher
Hi, I've seen Names.bindProperties(...) and thought that it could be a neat way of managing configuration using guice. On further thought, however, I realized I had some problems: 1. Some of my configuration values are multi-value - i.e. I'd need to inject a List or Map 2. Some of my configura

Re: How can I pass a parameter for a provider?

2009-08-14 Thread Max Bowsher
zhaoyi wrote: > Below is my code. When I running this program, I will get an error > "Could not find a suitable constructor in java.lang.Integer. Classes > must have either one (and only one) constructor annotated with @Inject > or a zero-argument constructor that is not private.". How can I pass a

Re: How can I make a provider create singleton object?

2009-08-15 Thread Max Bowsher
zhaoyi wrote: > This is my code. Whenever I call mouseActionFactoryProvider.get(), it > will return create an instance. It seems that the @Singleton doesn't > work here. > > @Singleton > public class MouseActionFactoryProvider implements > Provider { > > @Override > @Singleton >

Re: Specifying a servlet filter name

2009-08-22 Thread Max Bowsher
Cafesolo wrote: > Hi Dhanji, > > I don't know why it needs a name. It's a Wicket thing. I'm sure there > must be a good reason for this. Are you sure it really does? I use Wicket, though not (yet) with Guice, and I can't think of any particular reason. Max. signature.asc Description: OpenPGP

Re: Specifying a servlet filter name

2009-08-23 Thread Max Bowsher
Cafesolo wrote: > This is the exception's stack trace: > > java.lang.IllegalArgumentException: Error initializing WicketFilter - > you have no element with a url-pattern that uses > filter: Key[type=org.apache.wicket.protocol.http.WicketFilter, > annotation=[none]] > at org.apache.wicket.pr

Re: How can I pass a parameter for a provider?

2009-08-24 Thread Max Bowsher
Rick wrote: > On Fri, Aug 14, 2009 at 8:09 AM, Max Bowsher wrote: >> To answer your direct question, passing a parameter to a provider >> invocation is explained here: >> http://code.google.com/p/google-guice/wiki/AssistedInject > > (I know I posted this question in

Re: Specifying a servlet filter name

2009-08-24 Thread Max Bowsher
gagarin61 wrote: > I find this like just another approach of meta-oriented programming/ > configuration that become more popular novadays. It might be > inappropriate way for someone, but I personally find more > inappropriate to hide possibilities of configuration of standard > properties like fr

Re: Best practice in regard to JUnit testing?

2009-08-24 Thread Max Bowsher
Rick wrote: > I'm starting simple to get the hang of this, so I'd appreciate any > recommendations on how to set this up better and what I'm doing wrong. > > I have a TestModule that binds a provider: > > protected void configure() { > > bind(SqlSessionFactory.class).toProvider(SqlSessio

Re: How can I pass a parameter for a provider?

2009-08-24 Thread Max Bowsher
Rick wrote: > On Mon, Aug 24, 2009 at 8:12 AM, Max Bowsher <mailto:m...@f2s.com>> wrote: > > > What you're doing above seems reasonable to me - you'll need to > elaborate on "doesn't seem to work" to get help. > > > T

Re: Injecting Http Session

2009-08-31 Thread Max Bowsher
Damob wrote: > I don't know what I'm missing here or if it's because I'm using gwt- > Dispatch but, do I need to write something in the module class to get > it work ? I keep getting : > > 1) Error in custom provider, com.google.inject.OutOfScopeException: > Cannot access scoped object. Either we

Re: Knowing the stage in a module

2009-08-31 Thread Max Bowsher
Pablo Fernandez wrote: > Hi, > > I'd like to know the stage (PRODUCTION, DEVELOPMENT) that my injector > is in. > > I basically want to do something like this > > boolean indentXml = Injector.CURRENT_STAGE != PRODUCTION > bind(Boolean.class).annotatedWith(Names.named("xml.indent")).toInstance >

guice-grapher not in Maven repository. Intentional or oversight?

2009-09-21 Thread Max Bowsher
Hi, guice-grapher is not in the Maven repository though all other extensions are. Was it deliberately held back, or just overlooked? If the latter, please can it be published too. Thanks, Max. signature.asc Description: OpenPGP digital signature

Re: AssistedInject IllegalAccessError

2009-09-21 Thread Max Bowsher
Sam Berlin wrote: > I have a situation where we have a class with a factory provided by > AssistedInject. The class is package private, and the factory is an > interface defined in the class. For example: > >class FooImpl implements Foo { >static interface Factory { >FooI

Injecting into provider returned objects, and singletons that silently fail to be singletons

2009-09-30 Thread Max Bowsher
I have an abstract class, let's call it AbstractWidget, for which I want to implement a method, and have the result injected by Guice. I wrote my module like so: @Provides @Singleton AbstractWidget provideWidget(Injector injector) { AbstractWidget w = new AbstractWidget() { @Override

Re: Injecting into provider returned objects, and singletons that silently fail to be singletons

2009-10-01 Thread Max Bowsher
je...@swank.ca wrote: > > > On Sep 30, 1:35 pm, Max Bowsher wrote: >> 1) Guice didn't report my error, but silently violated singletonness >> instead. > Yep, it's a sinister known bug. Circular dependencies are bad, and we > made a mistake by supporting them

Members-injection of provider-created instances

2009-10-01 Thread Max Bowsher
Further to my previous question - is there any correct way to use Provider-created instances which themselves need to be injected? If so, could someone give me an example? Looking at the Guice source code, it appears that Guice tries very hard to deal with circular dependencies in trees that it c

Re: equivalent of PathMatchingResourcePatternResolver for guice

2009-10-16 Thread Max Bowsher
B. K. Oxley (binkley) wrote: > There are so many nice things in Guice, one hardly knows where to > start! (But I do know. :) > > One thing I miss from Spring framework, however, is > PathMatchingResourcePatternResolver -- the ability to find properties > files, etc., with genericy-looking express

Re: Guice + Warp + Hibernate = Session Closed

2010-02-02 Thread Max Bowsher
On 02/02/10 14:35, Maurixio wrote: Hello everyone ... after reading the Dependency Injection book (love this book btw) im trying to put up a project with Guice , Warp and Hibernate ... I have been trying a lot of thing the last week ... and i cant make it work .. im getting : org.hibernate.Hiber

Guice release schedule?

2010-03-17 Thread Max Bowsher
The trunk of Guice has changed quite a bit since 2.0. I'd like to start understanding the internals of Guice, but I'm hesitant to look at 2.0, when everything has moved around on trunk, but equally concerned that looking at trunk whilst using 2.0 in my projects may prove frustrating. Plus, I

Re: Guice release schedule?

2010-03-24 Thread Max Bowsher
Jeremy Chone wrote: > Max, > > Did you get a response to your question? I would be curious to know as well. Only your own response :-) No, I've not received any response off-list. Max. signature.asc Description: OpenPGP digital signature

Re: Guice release schedule?

2010-03-24 Thread Max Bowsher
JSR-330 support. We'll probably have a release in a couple months, but we don't have concrete plans at the moment. I'd like to see circular dep detection make it into this release. Bob On Wed, Mar 17, 2010 at 1:58 PM, Max Bowsher mailto:m...@

Re: How do you create a non-Thread-based Guice custom Scope?

2010-03-24 Thread Max Bowsher
On 24/03/10 18:47, Russ wrote: It seems that all Guice's out-of-the-box Scope implementations are inherently Thread-based (or ignore Threads entirely): Scopes.SINGLETON and Scopes.NO_SCOPE ignore Threads and are the edge cases: global scope and no scope. ServletScopes.REQUEST and ServletScopes.

Re: How do you create a non-Thread-based Guice custom Scope?

2010-03-24 Thread Max Bowsher
Russ Milliken wrote: > For the sake of argument let's say that I want my scope to be tied to > objects created in a certain method buried deep down in my > infrastructure. This method may be re-entered in the same Thread, and I > want another "scope" to be started upon re-entrance. Think of a Swi

Re: Guice release schedule?

2010-03-26 Thread Max Bowsher
On 26/03/10 11:37, James Strachan wrote: On 24 March 2010 17:33, Bob Lee wrote: The only change I can think of is JSR-330 support. Which would be great to release! We'll probably have a release in a couple months, with a whopping 2 releases in 3 years - slow down Bob! :) but we don't ha

Re: Guice release schedule?

2010-03-29 Thread Max Bowsher
On 26/03/10 22:21, Kartik Kumar wrote: Not to hijack this thread but any chances of guice-persist alpha-beta making it into the release? The guice trunk does not contain any sources. Except, you are hijacking this thread. You do no-one, including yourself, any favours by burying this question

Merge Maven pom.xml files into trunk?

2010-04-03 Thread Max Bowsher
For the Guice 1.0 and 2.0 releases, Maven pom.xml files were crafted on a branch after the release, and left on the branch. I would like to suggest that the pom.xml files from the 2.0-maven branch be copied into trunk (replacing 2.0 with 2.1-SNAPSHOT). This would make it more practical to keep th

Re: Merge Maven pom.xml files into trunk?

2010-04-03 Thread Max Bowsher
Brandon Atkinson wrote: > You could use maven to kick off the ant build > using the antrun plugin, that way you wouldn't have to maintain two > separate builds, but you could still use maven plugins (like the eclipse > and idea plugins). By the time you've filled in the POMs enough to make the mav

Re: Merge Maven pom.xml files into trunk?

2010-04-04 Thread Max Bowsher
Christian Edward Gruber wrote: > I wouldn't try to fill it in to use maven-eclipse-plugin - you need far > less to make m2eclipse work I've not used m2eclipse, but I don't understand how the above can be true: all you need for the maven-eclipse-plugin is a correct listing of dependencies and the c

Re: Bindings Based on Args

2010-04-04 Thread Max Bowsher
rod wrote: > Hi, > > I'm sure this question must have been asked a million times but I > can't find the answer... > > In my application the user can provide command line flags for various > options, one being the type of database to use. So I have a bunch of > implementations of my Database inte

Re: Merge Maven pom.xml files into trunk?

2010-04-06 Thread Max Bowsher
On 04/04/10 14:48, Christian Edward Gruber wrote: On Apr 4, 2010, at 9:31 AM, Max Bowsher wrote: Christian Edward Gruber wrote: I wouldn't try to fill it in to use maven-eclipse-plugin - you need far less to make m2eclipse work I've not used m2eclipse, but I don't understan

Re: Guice 3.0 SNAPSHOT

2010-08-31 Thread Max Bowsher
On 29/08/10 13:35, Deepak wrote: > Tried mvn:install on google-persist. But it just exports jar without > any class files. Any pointers will be appreciated. Guice does not officially have a Maven build at all. It just has POMs sufficient for providing metadata for an upload to the Maven central re

Re: Guice 3.0 SNAPSHOT

2010-08-31 Thread Max Bowsher
On 31/08/10 16:05, Christian Gruber wrote: > Max, if you need a hand, let me know. I had a successful run getting > pom.xml files sufficient for using m2eclipse (instead of mvn > eclipse:eclipse). Also, if you're having problems with getting > things into Central, I can possibly help there too.

Re: Why @Singleton does not have @Inherited?

2010-09-09 Thread Max Bowsher
On 09/09/10 15:23, Brian Pontarelli wrote: > > On Sep 9, 2010, at 3:22 AM, Aekold wrote: > >> Hi All! >> >> Are there any reasons why @interface Singleton does not have >> @Inherited annotation? If no - maybe it's not too late to add it to >> Guice 3.0? Just made abstract servlet for GWT services

Re: Guice 3.0 ?

2010-09-21 Thread Max Bowsher
On 21/09/10 16:24, Dhanji R. Prasanna wrote: > We'd love to do so, but as we are time-constrained we'd love for > volunteers to help with this process. Particularly in writing the build > poms and so forth... I've written poms that are good for local development already, and will be submitting a p

Re: guice aop: calling base class (non proxy) method?

2010-09-28 Thread Max Bowsher
On 25/09/10 18:21, Andrei Pozolotin wrote: > the confusion was due to guice 2.0 using INTERNAL COPY (OMG!) of cglib > while I had cglib in pom as a dependency; cglib's a very special case. Historically it's a serious compatibility pain, plus the upstream project is pretty much dead, and I think th

Re: Guice 3.0 RC1 Available

2010-12-09 Thread Max Bowsher
On 09/12/10 04:23, Sam Berlin wrote: > All, > > Guice 3.0 RC1 is now available. Please see > http://code.google.com/p/google-guice/wiki/Guice30 > for links and > details of what changed since Guice 2.0 (and since the last Guice 3.0 > snapshot).

Re: Guice 3.0 RC1 Available

2010-12-15 Thread Max Bowsher
On 09/12/10 13:16, Sam Berlin wrote: > So long as it's clear that it's an RC and not the full release, I don't > see how it could hurt having it in maven central. If you're able to do > that, Stuart (preferably with the existing artifacts instead of a new > build with potential, however minimal, d