Ah yes I think I gathered that but I was hell bent on not having to
actually create my own annotation just to inject a string into my
constructor args. Is that actually what you are refering to?
So AN_INT - is that an annotation you'd have to create? It would
really help my understanding if you could complete the example you
posted?
On Jul 26, 11:52 am, "Dhanji R. Prasanna" <
dha...@gmail.com> wrote:
> Interesting.
>
> You don't have to use the named annotation, you can use any binding
> annotation. Plus one minor advantage strings in @Named have over bean-ids in
> Spring is that you can point to a string constant checked at compile time:
> bindConstant().annotatedWith(named(AN_INT)).to(12);
>
> //elsewhere..
> @Inject @Named(AN_INT) int x;
>
> Dhanji.
>
> On Fri, Jul 25, 2008 at 11:20 PM, astubbs <
antony.stu...@gmail.com> wrote:
>
> > I created a blog post about injecting primitives and/or bind
> > toInstance because I didn't pick it up straight away off the user
> > guide and had to google it out a bit.for a clearer example. Just
> > wanted to share the love! Couldn't find anyone asking questions about
> > it in the forum either, so must be just me!
>
> >
http://stubbisms.wordpress.com/2008/07/26/google-guice-injecting-prim...