Hi,
 
I have a small "framework" built on hivemind.
There are several well known internal framework services, and some other services which may (or should) be defined by the user.
 
Let's suppose that there is a SessionFactory service interface, the user can define several session factory services in the descriptors like
 
<service-point ...
    <invoke-factory ....
        <construct...
 
            supply some parameters to the service like database URL, user and password
 
            (***) inject internal framework dependencies
 
        </construct>
    </invoke-factory>
</service-point>
 
I have problems at (***). Because the given SessionFactory implementation depends on several internal framework services as well, the user must know the IDs of these services and inject them in case of each session factory service point, which is neither good or efficient.
 
Is there a way to access the registry from a service implementation to avoid this problem? (Or any other solutions?)
In my specific case the given SessionFactory implementation would not require the manual injection of the internal services at (***) but it would get them directly from the registry or module! Something similar to Spring's ApplicationContextAware would be great... I know it is not as clean as pure injection but much simpler and safer for the user of my framework!
 
(I read in the docs that service deserialization uses a static registry variable. Is there a way for services to use it?)
 
Of course annotations would come handy in this case, as always :)
Using annotations, I would be able to define "default" injections in my SessionFactoryImpl service class, so the user won't need to care for them in the descriptors!
 
Any thoughts welcome! (Sorry for the long post!)
Regards,
Norbi

Reply via email to