15
BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

Embed Size (px)

Citation preview

Page 1: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

BoxSpring(draft)

Justin EdelsonVP, Applications & Platforms

MTV Networks Digital

Page 2: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

What is BoxSpring

• A set of enhancements to the Spring Framework.

Page 3: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.)

Page 4: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

Core BoxSpring Enhancements

• Pathed Bean Factories

• Layered Configuration

• GLOBAL Beans

• JMX Exposure of Bean Factories

• Path-Aware MVC Support

Page 5: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 6: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 7: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

Paths and Layers in Action

Page 8: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 9: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 10: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

JMX – Browse Bean Factories

Page 11: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

JMX – View Bean Definition

Page 12: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 13: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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.

Page 14: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

Box Spring Modules

• BoxSpring Modules are packages containing default BoxSpring configuration for 3rd party projects.

• First two:– Resteasy– Atlassian Crowd

• More to come…

Page 15: BoxSpring (draft) Justin Edelson VP, Applications & Platforms MTV Networks Digital

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…