Hello,

I can answer this myself, because I was just too stupid to parse that I used 
the same object reference twice when adding to the SymbolSource configuration. 
Which in turn led to my page not recognizing some symbols, because of course 
they weren't there.

Regards,
Daniel P.

-----Ursprüngliche Nachricht-----
Von: Poggenpohl, Daniel [mailto:daniel.poggenp...@isst.fraunhofer.de] 
Gesendet: Donnerstag, 3. September 2015 21:01
An: users@tapestry.apache.org
Betreff: Tapestry IoC - Two Implementations of the same Service class - Symbol 
Providers

Hello everyone,

I have a FileSymbolProvider. It looks for a file in the webapp classpath and 
reads the properties from the file.
I have defined two services based on the FileSymbolProvider, FileXProvider and 
FileYProvider.
One of them is configured to generate default values for properties with no 
values.

I have contributed both services to the SymbolSource configuration. But looking 
deep into Tapestry code, the providers list inside the SymbolSource contains 
not references to both SymbolProviders, but two references to the same 
SymbolProvider.

What am I doing wrong?

Code reference:
@ServiceId(value = "FileXProvider")
   public FileSymbolProvider buildFileXProvider(Map<String, Object> 
contributions, Logger logger)
   {
       return new FileSymbolProvider(contributions, logger, FILE_X_FILENAME, 
true);
   }

@ServiceId(value = "FileYProvider")
public FileSymbolProvider buildFileYProvider(Map<String, Object> contributions, 
Logger logger) {

   return new FileSymbolProvider(contributions, logger, FILE_Y_FILENAME, true); 
}


public static void contributeFileXProvider(MappedConfiguration<String, Object> 
configuration) {
   configuration.add(FileSymbolProvider.GENERATE_DEFAULTS_KEY, true);
   configuration.add(FileSymbolProvider.DEFAULT_VALUE_KEY, "UNKNOWN"); }

public static void contributeSymbolSource(
          OrderedConfiguration<SymbolProvider> configuration,
           @InjectService("FileXProvider") SymbolProvider fileXProvider,
      @InjectService("FileYProvider") SymbolProvider fileYProvider) {
       configuration.add(FILE_X_FILENAME, fileXProvider, 
"after:SystemProperties", "before:ApplicationDefaults");
   configuration.add(FILE_Y_FILENAME, fileYProvider, "after:SystemProperties", 
"before:ApplicationDefaults");
   }

Regards,
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to