Grails is a web framework based on Groovy and Java which can be deployed into existing Java web servers, e.g. Tomcat or Jetty. Its scaffolding capabilities let you create a new project within a few minutes. Grails is based on the “convention over configuration” idea which allows the application to auto-wires itself based on naming schemes (instead of using configuration files, e.gl XML files).
The Grails framework allows instance development without requiring any configuration. Grails accomplish this by automatically providing the Tomcat web container and the HSQLDB database during development.
Grails uses GORM (Grails Object Relational Mapping) for the persistence of the domain model. GORM is based on Hibernate. You can test with the HSQLDB and run in production against another database simply by changing the configuration file (DataSource.groovy).
Grails uses Java EE as the architectural basis and Spring for structuring the application via dependency injection.
Grails is plug-in based and provides its own build system (Gant). The Grails homepage provides several pre-defined plugins which extend the Grails framework.
Grails has been developed with a number of goals in mind:
- Provide a high-productivity web framework for the Java platform.
- Re-use proven Java technologies such as Hibernate and Spring under a simple, consistent interface
- Offer a consistent framework which reduces confusion and is easy to learn.
- Offer documentation for those parts of the framework which matter for its users.
- Provide what users expect in areas which are often complex and inconsistent:
- Powerful and consistent persistence framework.
- Powerful and easy to use view templates using GSP (Groovy Server Pages).
- Dynamic tag libraries to easily create web page components.
- Good Ajax support which is easy to extend and customize.
- Provide sample applications which demonstrate the power of the framework.
- Provide a complete development mode, including web server and automatic reload of resources.
Grails is an open source web application framework which leverages on Groovy (Figure 2: Grails is build on top of Groovy). It was first developed in 2005 and the first “1.0” release was announced in 2008 .
Figure : Grails Architecture
Grails builds on several well-established software frameworks, and combines their functionality via Groovy. These frameworks include Java Enterprise Edition (Java EE, JEE), spring, Hibernate and Quartz. Grails combines the speed of scripting languages with the stability and security of Java and is therefore ideally suited for enterprise use.