Seems like a decent solution to me.

Along those lines, you could also use a flag to set the location of the key
per configuration, and bind the value of the flag.  Not a terribly large
difference, as it's simply another way to effect the same end as property
files.

Fred

On Tue, May 31, 2011 at 10:08 AM, MH <[email protected]> wrote:

> Hi,
> I had similiar situation, but with database access properties (in fact I
> used a noSQL parameters, but that's another story).
>
> What I did, I created a configuration bean interface. The implementation
> relayed on Java property files, being read from the default implementation.
> The name of the file (or rather a URL object, as I used getResource()) is
> injected into the constructor of the configuration bean, as a @Named
> parameter.
>
> You can either swap the property files when you need (for dev/prod), or
> distinct that in the configuration of the module, e.g. by comparing a system
> property.
>
> This is just my approach, so you shouldn't take it as a reference solution.
> I'm not saying it's the best one, it just works for me:) Maybe someone will
> come up with a better one.
>
> Best regards,
> Mateusz
>
>
> 2011/5/31 Bogdan Sulima <[email protected]>
>
>> Hello,
>>
>> i have different API keys for my dev and prod system (due to different
>> base URLs).
>> What is the best way to provide those system-dependent keys to guice
>> injector?
>>
>> Bogdan.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to