hi, I want to add a TypeCoercer using tapestry-hibernate.
public static void contributeTypeCoercer( Configuration<CoercionTuple> configuration, @Inject final Session session) { Coercion<PersistModel, String> coercion1 = new Coercion<PersistModel, String>() { public String coerce(PersistModel input) { return getEntityClass(input).getName()+ ":" + session.getIdentifier(input); } }; configuration.add(new CoercionTuple<PersistModel, String>( PersistModel.class, String.class, coercion1)); Coercion<String,PersistModel> coercion2= new Coercion<String,PersistModel>() { public PersistModel coerce(String input) { String [] strs=input.split(":"); return (PersistModel) session.get(strs[0],strs[1]); } }; configuration.add(new CoercionTuple< String,PersistModel>( String.class, PersistModel.class, coercion2)); } java.lang.RuntimeException: Exception constructing service 'ServletApplicationInitializer': Unable to instantiate class org.apache.tapestry.services.TapestryModule as a module builder: Exception constructing service 'Alias': Error invoking service builder method org.apache.tapestry.services.TapestryModule.build(Log, String, AliasManager, Collection) (at TapestryModule.java:249) (for service 'Alias'): Exception constructing service 'TypeCoercer': Error invoking constructor org.apache.tapestry.ioc.internal.services.TypeCoercerImpl(Collection) (at TypeCoercerImpl.java:101) (for service 'TypeCoercer'): Error invoking service contribution method lichen.services.AppModule.contributeTypeCoercer(Configuration, Session): Exception constructing service 'Alias': Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry.services.TapestryModule.build(Log, String, AliasManager, Collection) (at TapestryModule.java:249) for references to another service that is itself dependent on service 'Alias'. Session depends Alias ,and Alias depends TypeCoercer. How to fix? Thanks. Jun Tsai -- Welcome to China Java Users Group(CNJUG). http://cnjug.dev.java.net