150 likes | 219 Views
BoxSpring (draft). Justin Edelson VP, Applications & Platforms MTV Networks Digital. What is BoxSpring. A set of enhancements to the Spring Framework. Why Does BoxSpring Exist?. Apply lessons learned from ATG Dynamo while enabling a migration strategy. Codify configuration methodology.
E N D
BoxSpring(draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital
What is BoxSpring • A set of enhancements to the Spring Framework.
Why Does BoxSpring Exist? • Apply lessons learned from ATG Dynamo while enabling a migration strategy. • Codify configuration methodology. • Reduce lock contention issues associated with XML-based configuration (see Struts, Tiles, etc.)
Core BoxSpring Enhancements • Pathed Bean Factories • Layered Configuration • GLOBAL Beans • JMX Exposure of Bean Factories • Path-Aware MVC Support
Pathed Bean Factories • Out of the box, Spring bean factories are flat – all beans within a factory share a common namespace. • Various techniques have emerged, but these are ad hoc. • Box Spring codifies a namespacing technique based on file system paths. • The bean named /DataSources/readDataSource is defined in /DataSources/applicationContext.xml • These files/directories can be in the classpath, the file system, really anywhere Spring Resources can work. • Smaller XML files – less lock contention and easier to read.
Layered Bean Configuration • In a typical application, some configuration properties are common between various deployment stages: dev, qa, testing, production, etc. • Default Spring configuration handling requires either recreating entire bean definitions per stage or the (awkward) use of property files. • Box Spring supports adding new property definitions in a stage-specific configuration files. • Special “operators” allow for addition or removal of items in collections.
GLOBAL Beans • GLOBAL beans are similar to Spring parent beans – define a set of properties common across N number of beans. • The main difference – GLOBAL beans are automatic (and thus less error prone). • Want to define a property for every bean in your application? Create a GLOBAL bean in the root context.
JMX Exposure of Bean Factories • Spring’s JMX support is focused on exposing individual beans for management. • This is important, but doesn’t address managing factories. • Nor does it allow you to inspect bean definitions at runtime. • And we wanted to apply the same path structure to JMX because lots of beans can lead to a messy JConsole.
Path-Aware MVC Support • Pretty simple • /admin/users/list.html -> controller named list in /admin/users • Again – all about lock contention • Not always appropriate, so it’s easy to disable.
BoxSpring-Enabled Libraries • BoxSpring-Enabled libraries include default set of configuration files in META-INF/spring. • This resource path is automatically scanned for configuration files when using BoxSpring webapp support classes. • Gets rid of includes (and name conflicts). • Layered configuration allows for defaults to be easily overridden.
Box Spring Modules • BoxSpring Modules are packages containing default BoxSpring configuration for 3rd party projects. • First two: • Resteasy • Atlassian Crowd • More to come…
Box Spring “Platform” • BoxSpring includes a BoxSpring-enabled library called BoxSpring Platform that includes: • A global Quartz scheduler • Config to expose the application context via JMX • Config to expose BoxSpring MVC support • More to come…