Boris - not sure how helpful this would be, but here's my 2c. I'm not
entirely sure how you might accomplish the hierarchy of symbols that you're
looking for, but I think I've had an alternative approach that might
accomplish the same.

In the past, I've primarily accomplished this using Maven build magic and
property replacement. Thus, I'd have a single .properties file which
contains the symbols that I need in my application, and then I'd have maven
"build profile" specific properties that are substituted in the .properties
file using maven filtering.

e.g. in somesymbols.properties (making sure it's a filtered resource in
maven)
# static symbol, doesn't depend on the environment
foo=bar
# environment specific symbol
monkey=${envMonkey}

in a maven profile, e.g. development-profile:
<envMonkey>devMonkey</envMonkey)
in a maven profile, e.g. prod-profile
<envMonkey>prodMonkey</envMonkey>

Cheers - Alex K

On Sat, Nov 8, 2014 at 11:17 AM, Boris Horvat <horvat.z.bo...@gmail.com>
wrote:

> Hi all,
>
> I have the following folders structure
>
> /payex.properties
>
> /prod/payex.properties
> /dev/payex.properties
>
> My idea is for the tapestry to always load the root (/payex.properties) and
> then give the execution mode to load one of the payex.properties that
> contain environment specific fields. My first initial guess was to try
> something like
>
>     public static void contributeSymbolSource(final
> OrderedConfiguration<SymbolProvider> configuration,
> @Symbol(SymbolConstants.EXECUTION_MODE) String environment) {
>         configuration.add("PayexSymbols", new
> ClasspathResourceSymbolProvider("payex.properties"),
> "before:ApplicationDefaults");
>         configuration.add("PayexSymbols", new
> ClasspathResourceSymbolProvider(environment + "/payex.properties"),
> "before:ApplicationDefaults");
>     }
>
> But I got the following exception.
>
> java.lang.IllegalStateException: Construction of service 'SymbolSource' has
> failed due to recursion: the service depends on itself in some way. Please
> check org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl(List) (at
> SymbolSourceImpl.java:198) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49) for references to another service that is itself
> dependent on service 'SymbolSource'.
>
> I guess I can't use @Symbol at the same time I want to contribute to it
>
> Is my hierarchy even possible to achieve given all of this?
> --
> Sincerely
> *Boris Horvat*
>

Reply via email to