You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Weisu <we...@gmail.com> on 2007/04/02 03:12:21 UTC
T5-How to inject ASO into a IoC Service
Hi, I am trying to inject a ASO to a service, I use the code below but
failed, not sure it the right way.
public class AppModule
{
private final EllipseSession _ellipseSession;
public AppModule(
@InjectService("EllipseSession") EllipseSession session)
{_ellipseSession = session;}
public void contributeApplicationStateManager(MappedConfiguration<Class,
ApplicationStateContribution> configuration)
{
ApplicationStateCreator<EllipseUser> creator = new
ApplicationStateCreator<EllipseUser>()
{
public EllipseUser create()
{return new EllipseUser(_ellipseSession);}
};
configuration.add(EllipseUser.class, new
ApplicationStateContribution("session", creator));
}
@Lifecycle("perthread")
public static EllipseSession
buildEllipseSession(@InjectService("ThreadCleanupHub") ThreadCleanupHub
threadCleanupHub)
{
EllipseSessionImpl service = new EllipseSessionImpl();
threadCleanupHub.addThreadCleanupListener(service);
return service;
}
public EllipseInvoice buildEllipseInvoice(
@Inject("EllipseUser") EllipseUser _ellipseUser)
{
return new EllipseInvoiceImpl(_ellipseUser);
}
}
Error invoking service builder method
com.mainco.ellipse.services.AppModule.buildEllipseInvoice(EllipseUser) (at
AppModule.java:86) (for service 'EllipseInvoice'): Could not find a coercion
from type java.lang.String to type com.mainco.ellipse.data.EllipseUser.
Available coercions: Double --> Float, Float --> Double, Long --> Boolean,
Long --> Byte, Long --> Double, Long --> Integer, Long --> Short, Number -->
Long, Object --> String, Object --> java.util.List, Object[] -->
java.util.List, String --> Boolean, String --> Double, String --> Long,
String --> java.math.BigDecimal, String --> java.math.BigInteger, String -->
org.apache.tapestry.SelectModel, String -->
org.apache.tapestry.corelib.data.GridPagerPosition, java.math.BigDecimal -->
Double, java.util.Collection --> Boolean, java.util.List -->
org.apache.tapestry.SelectModel, java.util.List -->
org.apache.tapestry.grid.GridDataSource, java.util.Map -->
org.apache.tapestry.SelectModel, null --> Boolean, null --> String, null -->
java.util.List, null --> org.apache.tapestry.grid.GridDataSource.
--
View this message in context: http://www.nabble.com/T5-How-to-inject-ASO-into-a-IoC-Service-tf3503220.html#a9783926
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