Spring Configuration Support
salaboy21 Jun 8, 2008 11:06 AMThis weekend we were working trying to solve Jira#PVM-44 (spring configuration support).
At the moment we are trying to learn wich part of your configuration framework has to be done with Spring.
We first did an SpringEnvironmentFactory extending EnvironmentFactory. About this we have this first impressions:
* There is some coupling with all the parser lifecycle, meaning that in Spring there is no such concept (at the high level, of course). As we understood the intention is that we must make our own Parser that receives the config file location, parse it until we get the SpringEnvironmentFactory. This is not posible without going to deep into the spring architecture. In spring you just create an XmlApplicationContext instance from the file and you ask it for defined beans. The solution was to make an static method SpringEnvironmentFactory#parse(InputStream) -just to follow your conventions, but using this concept in spring is not really usual- that accomplish this task but ignoring all the other way.
* We defined a Context in the Environment containing a hibernate session. At first time we tried to make a SimpleContext just implementing the Context interface and keeping it as pojo as possible, to be able to fill it with Spring. We made it and succesfully register the HibernateSession on it. But the problem began when we tried to get it by class (type). The hibernate session get registered as SessionFactoryImpl and in the code it is invoked as get(SessionFactory.Class). Digging into the code we realize that all this registrations had to be done by a layer of Descriptors through the WireContext. Now the problem is that all this layer is not really so much pojo-oriented in the sense that there are no getters and setters for every property.
* Maybe the whole package org.jbpm.pvm.internal.wire.* should be avoided in the Spring configuration. But when we try to get this we realize that there are some coupling between the usage of services and the way that they get 'injected' and even this approach will translate in a lot of duplications in the code.
Have you any suggestion about this topics?
Beside how we resolve this, is necesary to add in your ivy repository the Spring dependencies. At the moment we have
Thanks.
Mauricio Salatino - Diego López León
PS: do you get all the notification for JIRA comments? Let us know if you want to see our code.