Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9888

Improved support for 'containerless' web application architectures

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Web
    • Labels:
    • Last commented by a User:
      true

      Description

      As the enterprise development landscape grows more diverse the simpler the application framework the more likely developers are to adopt the framework. Developers with existing knowledge of previously common frameworks like the Servlet container are becoming more rare. Spring's dependence on frameworks and containers outside of Spring's component model increases the learning curve of new developers attempting to create and maintain spring web applications.

      Traditionally Spring web applications have been embedded in a servlet container. This was useful in the past when the majority of enterprise applications ran in and depended on the servlet container for deployment and configuration. However, a servlet container comes with learning curve that we cannot assume new developers will have already overcome. The learning curve includes things such as:

      • web.xml and other Servlet oriented configuration concepts
      • .war directory structure
      • Container implementation specific items (e.g. ports, thread pools, etc.)
      • Complex Classloading hierarchies
      • Monitoring and management facilities configured outside of the application
      • Logging facilities
      • Configuration of application context roots
      • So forth

      All of the above items are configured in inconsistent non-unified ways requiring a development team to learn these for the container their using in addition to Spring's own configuration model.

      I think that Spring's web application architecture can be significantly simplified if it were to provided tools and a reference architecture that leveraged the Spring component and configuration model from top to bottom. Embedding and unifying the configuration of those common web container services within a Spring Container bootstrapped from a simple main() method.

      Though there are many frameworks and platforms today that no longer require a container I think inspiration can be drawn most from DropWizard (http://dropwizard.codahale.com/).

      Another project I've seen inspired by DropWizard but leveraging Spring is HalfPipe (https://github.com/32degrees/halfpipe). Though I don't think HalfPipe goes far enough. I think to truly provide simplification the entire architecture, wherever reasonable, must be embedded within the Spring container rather than without. Though it does have several other interesting ideas.

      I believe that a Spring driven containerless web application architecture could provide benefits like:

      • Provide a single unified component model requiring no knowledge of the Servlet Component models.
      • Unified configuration of everything allowing developers to only have to learn one Spring configuration model for both component and app configuration.
      • Execution from a void main will simplify application startup and shutdown.
      • A much simpler pure java classloading hierarchy.
      • Simpler development tooling. Instead of needing a complex IDE to construct a war and deploy it to a dev container simply execute the applications Main class.

      For such an architecture to be successful this architecture will also need new and simple ways to configure common Spring tools, such as Spring MVC and Spring Security, that have traditionally been configured through the servlet container.

      To accomplish this simplification I don't think Spring would need to create a brand new http engine. It could simply utilize an embedded servlet container like Jetty. Though it would need to abstract away as much configuration as possible.

      I think a reference app would also be unnecessary to set an example of how to structure, develop and configure such an application in a pure spring manner.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwebb Phil Webb
                Reporter:
                youngm Mike Youngstrom
                Last updater:
                Mike Youngstrom
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 42 weeks ago