You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by Anatole Tresch <an...@apache.org> on 2014/12/19 07:40:42 UTC

Re: Tamaya: file.properties

Hi,
Currently IMO this only works by adding your file to a config provider and
then performing injection using the configure method. I think i will add an
additional configure method that takes a config as an argument. So you can
do:

Configuration cfg =
ConfigBuilder.of().addPaths("file:file.properties").build();
MyObject o. = ...;
Confuguration.configure(o, cfg);

Cheers
Anatole


Otávio Gonçalves de Santana <ot...@gmail.com> schrieb am
Fr., 19. Dez. 2014 um 01:18:

> Hi Anatole.
> How is going?
> One question: in tamaya how can I configure file.properties and inject in
> my fields?
> I dont find any example, did is there  implemented?
>
>
> --
> Otávio Gonçalves de Santana
>
> blog:     http://otaviosantana.blogspot.com.br/
> twitter: http://twitter.com/otaviojava
> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
> 55 (11) 98255-3513
>
>

Re: Tamaya: file.properties

Posted by Anatole Tresch <an...@apache.org>.
Hi Antonio / all

the default fallback metamodel currently implemented in core (
org.apache.tamaya.core.internal.config.DefaultConfigurationManagerSingletonSpi$FallbackSimpleConfigProvider)
 loads the following config:

*1) Defaults from classpath:*
META-INF/cfg/default/**/*;.xml, META-INF/cfg/default/**/*;.properties,
META-INF/cfg/default/**/*.ini

*2) Overwritable by classpath: *
META-INF/cfg/config/**/*.xml, META-INF/cfg/config/**/*.properties,
META-INF/cfg/config/**/*.ini

*3) Overwritable by files*, defined by the system property
-Dconfig.dir=<expression>

*4) **Overwritable** by system properties*


Everything is accessible from
Configuration.current(); // the default config

-Anatole


2014-12-19 10:38 GMT+01:00 Otávio Gonçalves de Santana <
otaviopolianasantana@gmail.com>:
>
> Hum.
> I thought something more automatic like a file, maybe tamaya.files, that
> has path of this files. This file will stay in root of project.
> Like the ehcache configuration does.
>
>
> On Fri, Dec 19, 2014 at 4:40 AM, Anatole Tresch <an...@apache.org>
> wrote:
> >
> > Hi,
> > Currently IMO this only works by adding your file to a config provider
> and
> > then performing injection using the configure method. I think i will add
> an
> > additional configure method that takes a config as an argument. So you
> can
> > do:
> >
> > Configuration cfg =
> > ConfigBuilder.of().addPaths("file:file.properties").build();
> > MyObject o. = ...;
> > Confuguration.configure(o, cfg);
> >
> > Cheers
> > Anatole
> >
> >
> > Otávio Gonçalves de Santana <ot...@gmail.com> schrieb am
> > Fr., 19. Dez. 2014 um 01:18:
> >
> > Hi Anatole.
> >> How is going?
> >> One question: in tamaya how can I configure file.properties and inject
> in
> >> my fields?
> >> I dont find any example, did is there  implemented?
> >>
> >>
> >> --
> >> Otávio Gonçalves de Santana
> >>
> >> blog:     http://otaviosantana.blogspot.com.br/
> >> twitter: http://twitter.com/otaviojava
> >> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
> >> 55 (11) 98255-3513
> >>
> >>
>
> --
> Otávio Gonçalves de Santana
>
> blog:     http://otaviosantana.blogspot.com.br/
> twitter: http://twitter.com/otaviojava
> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
> 55 (11) 98255-3513
>

Re: Tamaya: file.properties

Posted by Romain Manni-Bucau <rm...@gmail.com>.
You want a default config file? It is common for sure + IIRC tamaya
has merge policy so already better than other "default"
implementations (ie we can get all files and merge them). Should
support classpath as well I guess but classpath priority should be <
file < system properties.


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-12-19 10:38 GMT+01:00 Otávio Gonçalves de Santana
<ot...@gmail.com>:
> Hum.
> I thought something more automatic like a file, maybe tamaya.files, that
> has path of this files. This file will stay in root of project.
> Like the ehcache configuration does.
>
>
> On Fri, Dec 19, 2014 at 4:40 AM, Anatole Tresch <an...@apache.org> wrote:
>>
>> Hi,
>> Currently IMO this only works by adding your file to a config provider and
>> then performing injection using the configure method. I think i will add an
>> additional configure method that takes a config as an argument. So you can
>> do:
>>
>> Configuration cfg =
>> ConfigBuilder.of().addPaths("file:file.properties").build();
>> MyObject o. = ...;
>> Confuguration.configure(o, cfg);
>>
>> Cheers
>> Anatole
>>
>>
>> Otávio Gonçalves de Santana <ot...@gmail.com> schrieb am
>> Fr., 19. Dez. 2014 um 01:18:
>>
>> Hi Anatole.
>>> How is going?
>>> One question: in tamaya how can I configure file.properties and inject in
>>> my fields?
>>> I dont find any example, did is there  implemented?
>>>
>>>
>>> --
>>> Otávio Gonçalves de Santana
>>>
>>> blog:     http://otaviosantana.blogspot.com.br/
>>> twitter: http://twitter.com/otaviojava
>>> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
>>> 55 (11) 98255-3513
>>>
>>>
>
> --
> Otávio Gonçalves de Santana
>
> blog:     http://otaviosantana.blogspot.com.br/
> twitter: http://twitter.com/otaviojava
> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
> 55 (11) 98255-3513

Re: Tamaya: file.properties

Posted by Otávio Gonçalves de Santana <ot...@gmail.com>.
Hum.
I thought something more automatic like a file, maybe tamaya.files, that
has path of this files. This file will stay in root of project.
Like the ehcache configuration does.


On Fri, Dec 19, 2014 at 4:40 AM, Anatole Tresch <an...@apache.org> wrote:
>
> Hi,
> Currently IMO this only works by adding your file to a config provider and
> then performing injection using the configure method. I think i will add an
> additional configure method that takes a config as an argument. So you can
> do:
>
> Configuration cfg =
> ConfigBuilder.of().addPaths("file:file.properties").build();
> MyObject o. = ...;
> Confuguration.configure(o, cfg);
>
> Cheers
> Anatole
>
>
> Otávio Gonçalves de Santana <ot...@gmail.com> schrieb am
> Fr., 19. Dez. 2014 um 01:18:
>
> Hi Anatole.
>> How is going?
>> One question: in tamaya how can I configure file.properties and inject in
>> my fields?
>> I dont find any example, did is there  implemented?
>>
>>
>> --
>> Otávio Gonçalves de Santana
>>
>> blog:     http://otaviosantana.blogspot.com.br/
>> twitter: http://twitter.com/otaviojava
>> site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
>> 55 (11) 98255-3513
>>
>>

-- 
Otávio Gonçalves de Santana

blog:     http://otaviosantana.blogspot.com.br/
twitter: http://twitter.com/otaviojava
site:     *http://about.me/otaviojava <http://about.me/otaviojava>*
55 (11) 98255-3513