Thanks Thiago, sometimes its to easy :).

Now I've got everything injected, but my EventListenerHibernateConfigurer still don't work:

java.lang.RuntimeException: Exception constructing service 
'ValueEncoderSource': Error invoking service contribution method 
org.apache.tapestry5.hibernate.modules.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
 boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess, 
LoggerSource): Exception constructing service 'HibernateSessionSource': Error 
invoking constructor public 
org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(org.slf4j.Logger,java.util.List):
 Exception constructing service 'HibernateSessionSource': Construction of 
service 'HibernateSessionSource' has failed due to recursion: the service 
depends on itself in some way. Please check 
org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl(Logger, 
List) (at HibernateSessionSourceImpl.java:36) via 
org.apache.tapestry5.hibernate.modules.HibernateCoreModule.bind(ServiceBinder) 
(at HibernateCoreModule.java:43) for references to another service that is 
itself dependent on service 'HibernateSessionSource'.
        at 
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)

It looks like I can't inject the HibernateSessionSource because my Configurer is called from there (maybe a circular dependency?): public HibernateSessionSourceImpl(Logger logger, List<HibernateConfigurer> hibernateConfigurers) {
        l// ...
        for (HibernateConfigurer configurer : hibernateConfigurers)
            configurer.configure(configuration);
        // ...
    }

I don't see another way of getting the HibernateSessionSource or the SessionFactory.


On 16.12.2013 13:30, Thiago H de Paula Figueiredo wrote:
On Sun, 15 Dec 2013 12:08:53 -0200, Matthias <thegreatme...@gmail.com> wrote:

in AppModule
public static void contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> config) { config.add("EventListener", new EventListenerHibernateConfigurer());
     }

If you use the 'new' keyword directly, no injection is done. The shortest way is to use config.addInstance("EventListener", EventListenerHibernateConfigurer.class). That will instantiate your class and do injections as if it was a service.




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

Reply via email to