You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by derkoe <ta...@gmail.com> on 2013/02/04 20:55:19 UTC
Tapestry > 5.3 makes it impossible to load symbols from DB
(TAP5-1823)
We need to change some Tapestry symbols based on values from the database,
e.g. the SUPPORTED_LOCALES. We have a SettingsService that reads the values
- this service uses Hibernate, so it needs Tapestry IoC to be configured.
We use something like this to add the symbol:
public static void contributeApplicationDefaults(MappedConfiguration<String,
String> configuration, SettingsService settings) {
configuration.add(SymbolConstants.SUPPORTED_LOCALES,
settings.getString(UISymbolConstants.SUPPORTED_LOCALES, "de,en"));
}
This worked fine in Tapestry 5.2.x - now we upgraded to 5.3.x and we get an
ERROR during IoC initialization: "Construction of service 'ServiceOverride'
has failed due to recursion".
The reason behind this is the new TapestryModule#productionModeOverrides -
this method makes ServiceOverride dependent on symbols (hence SymbolSource).
We also tried another approach with contributing to SymbolSource:
@Contribute(SymbolSource.class)
public static void
addSettingsSymbolSource(OrderedConfiguration<SymbolProvider> configuration,
final SettingsService settings) {
configuration.add("settings", new SymbolProvider()
{
public String valueForSymbol(String symbolName)
{
return settings.getString(symbolName, null);
}
}, "after:*");
}
with the same result.
There was already a bug filed (closed without solution):
https://issues.apache.org/jira/browse/TAP5-1823
Has anyone an idea how to solve this problem?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-3-makes-it-impossible-to-load-symbols-from-DB-TAP5-1823-tp5719752.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry > 5.3 makes it impossible to load symbols from DB (TAP5-1823)
Posted by Steve Eynon <st...@alienfactory.co.uk>.
Assuming the SettingsService resides in the same module, try this:
public static void contributeApplicationDefaults(MappedConfiguration
configuration, @Local SettingsService settings) {
settings.getString(UISymbolConstants.SUPPORTED_LOCALES, "de,en"));
}
the @Local annotation tells T5 not to look elsewhere for the service definition.
Steve.
--
Steve Eynon
-------------------------------
"If at first you don't succeed,
so much for skydiving!"
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry > 5.3 makes it impossible to load symbols from DB
(TAP5-1823)
Posted by derkoe <ta...@gmail.com>.
Lance Java wrote
> As suggested in the Jira, your SettingsService could @Inject ObjectLocator
> instead of the hibernate session. It could then lazily call
> ObjectLocator.getService(Session.class) to get the hibernate session.
This doesn't work since a method is invoked on the SettingsService in the
contribution and the exception is thrown when realizing the service.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-3-makes-it-impossible-to-load-symbols-from-DB-TAP5-1823-tp5719752p5719889.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry > 5.3 makes it impossible to load symbols from DB
(TAP5-1823)
Posted by Lance Java <la...@googlemail.com>.
As suggested in the Jira, your SettingsService could @Inject ObjectLocator
instead of the hibernate session. It could then lazily call
ObjectLocator.getService(Session.class) to get the hibernate session.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-3-makes-it-impossible-to-load-symbols-from-DB-TAP5-1823-tp5719752p5719763.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org