...
- It's homegrown. Better, more widely-understood frameworks have come along.
- Unit testing is unnecessarily complicated. The base Module class depends on a Server instance being available in order to function, and the Server base class is not easily mocked.
Requirements
Use standard, well-known frameworks/libraries to:
- Resolve inter-module dependencies via dependency injection
- Provide hooks to initialize/de-initialize modules when the webapp container starts and stops
- Allow re-configuration and plugging in of alternative modules without re-compiling
Non-requirements
This work will NOT attempt to:
...
| Spring | PicoContainer | Guice |
---|---|---|---|
Supports start/stop lifecycle hooks for components | Yes (interface or xml-configured) | Yes (interface or annotation) | |
Supports autowiring | Yes | Yes | Yes |
Supports in-code wiring and configuration | Yes (JavaConfig) | Yes | Yes |
Supports external wiring (outside of code) | Yes (xml) | No | Not directly (but it's possible) |
Supports external config (outside of code) | Yes (xml and/or properties) | No | Yes (Names.bindProperties) |
OSGi-Friendly | Yes (Spring-DM) | Unknown | Yes (Guice-Peaberry) |
JSR-330 Support | |||
Jar Footprint (non-OSGi) | 750kb | 300kb | 650kb |
Implementation Principles
- Prefer constructor injection to setter injection
- Minimize coupling of code with DI framework
- Avoid refactoring
Implementation Steps
- Pick a framework.
- Xyz
Current Inter-Module Dependencies
...