See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 16.1 The Underpinnings of Grails - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 2.3.8 ## 16.1 The Underpinnings of Grails Grails is actually a Spring MVC application in disguise. Spring MVC is the Spring framework's built-in MVC web application framework. Although Spring MVC suffers from some of the same difficulties as frameworks like Struts in terms of its ease of use, it is superbly designed and architected and was, for Grails, the perfect framework to build another framework on top of. Grails leverages Spring MVC in the following areas: Basic controller logic - Grails subclasses Spring's DispatcherServlet and uses it to delegate to Grails controllers Data Binding and Validation - Grails' validation and data binding capabilities are built on those provided by Spring Runtime configuration - Grails' entire runtime convention based system is wired together by a Spring ApplicationContext Transactions - Grails uses Spring's transaction management in GORM In other words Grails has Spring embedded running all the way through it. #### The Grails ApplicationContext Spring developers are often keen to understand how the Grails `ApplicationContext` instance is constructed. The basics of it are as follows. Grails constructs a parent `ApplicationContext` from the `web-app/WEB-INF/applicationContext.xml` file. This `ApplicationContext` configures the GrailsApplication instance and the GrailsPluginManager. Using this `ApplicationContext` as a parent Grails' analyses the conventions with the `GrailsApplication` instance and constructs a child `ApplicationContext` that is used as the root `ApplicationContext` of the web application #### Configured Spring Beans Most of Grails' configuration happens at runtime. Each plugin may configure Spring beans that are registered in the `ApplicationContext`. For a reference as to which beans are configured, refer to the reference guide which describes each of the Grails plugins and which beans they configure. | Quick Reference (hide)