Dependency Injection in OpenEdge via Spring

Posted by bronco on 08-Nov-2015 14:03

With the EMEA Pug Challenge and the birds of a feather session on the CCS fresh in mind I remembered some software I wrote a couple of years ago. With the CCS well underway the topic of dependency injection (DI) will be sooner of later part of the discussion as well. Spring is (among a lot of other things) a DI container, which is used in its Java incarnation by OE itself as well. There's however no ABL implementation, as far as I know. My take on Spring's DI can be found at github:

https://github.com/bfv/spring4oe

It is based on the 2.5 specs which is quite some years old, but does the trick. Spring4oe is MIT licensed, so feel free to do whatever you want with (comments/suggestion/contributions are welcome).

As far as for what OpenEdge version this is for, I use block-level so that means at least 11.2. You can work your way around that but since dynamic-property is used as well I would say 11.x is necessary. If your not on 11, now is the time I would say.

All Replies

Posted by Thomas Mercer-Hursh on 08-Nov-2015 14:39

You might be interested in my paper from EMEA PC cintegrity.com/.../Layers-Subsystems-and-Separation-Concerns-Oh-My which includes a reference link to Peter Judge's previous postings on DI.

Posted by agent_008_nl on 09-Nov-2015 00:13

> There's however no ABL implementation, as far as I know.

So you forgot about injectABL?? Hard to believe.  I told you about it in person.

github.com/.../InjectABL (recommended!)

Posted by bronco on 09-Nov-2015 01:33

For those of you pointing out that there's InjectABL, I meant there's no ABL implementation of Spring that I'm aware of. Some background, the majority of the code was written in 2009 (hence the 2.5 specs) and only "recently" updated to use  dynamic properties. Besides this, it's always good to have something to choose from. Not everyone has the same preferences and besides that, Spring is used as well for configuring all the PASOE stuff, so learning some about the structure of the Spring XML can be useful.

Posted by agent_008_nl on 09-Nov-2015 01:55

Ok. For those wanting to compare ninject (the example for injectABL see community.progress.com/.../998.oeri-dependency-injection-container-injectabl) and spring see google. There has been written enough about it (and maybe Peter Judge cares to explain why he chose ninject - over spring and others - as example).

Posted by Peter Judge on 11-Nov-2015 08:34

I used Ninject for a couple of reasons, but largely because you could strongly-type the mappings (in addition to document- or database-table- based mappings) which should help with missing/broken mappings.
 
(If I recall right) Spring was also much more than DI and all I wanted at the time was an IoC container.
 
InjectABL could stand some updates post 11.6 – now that there's reflection on constructors (methods) and their parameters.
 
And I wholeheartedly agree that the more, the merrier.
 
(NB that link Stefan posted has changed due to one of our PSDN/Community platform moves. It's now  community.progress.com/.../998.oeri-dependency-injection-container-injectabl )
 
 

This thread is closed