(Quick Reference)

1 Introduction

Version: 7.0.0-SNAPSHOT

1 Introduction

Many modern web frameworks in the Java space are more complicated than needed and don’t embrace the Don’t Repeat Yourself (DRY) principles.

Dynamic frameworks like Rails and Django helped pave the way to a more modern way of thinking about web applications. Grails builds on these concepts and dramatically reduces the complexity of building web applications on the Java platform. What makes it different, however, is that it does so by building on already established Java technologies like Spring and Hibernate.

Grails is a full stack framework and attempts to solve as many pieces of the web development puzzle through the core technology and its associated plugins. Included out the box are things like:

All of these are made easy to use through the power of the Groovy language and the extensive use of Domain Specific Languages (DSLs)

This documentation will take you through getting started with Grails and building web applications with the Grails framework.

In addition to this documentation there are comprehensive guides that walk you through various aspects of the technology.

Finally, Grails is far more than just a web framework and is made up of various sub-projects. The following table summarizes some other key projects in the eco-system with links to documentation.

Table 1. Grails Ecosystem Projects
Project Description

GORM for Hibernate

An Object Mapping implementation for SQL databases

GORM for MongoDB

An Object Mapping implementation for the MongoDB Document Database

GORM for Neo4j

An Object Mapping implementation for Neo4j Graph Database

JSON Views

A View technology for rendering JSON on the server side

Groovy Server Pages

A View technology for rendering HTML and other markup on the server

Async Framework

Asynchronous programming abstraction with support for RxJava, GPars and more

1.1 What's new in Grails 7?

This section covers all the new features introduced in Grails 7

Overview

Grails 7.0.0-SNAPSHOT is a major release that includes new features, improvements, and dependency upgrades. This release focuses on enhancing the developer experience, improving performance, and ensuring compatibility with the latest technologies.

For detailed information on how to upgrade to Grails 7, including major dependency changes, please see the Upgrading from Grails 6 to Grails 7 section. Notable new features are included below.

External Configuration

The external configuration plugin is now integrated into Grails. See the Configuration section for details.

Ubiquitous Containerized Browser Testing with Geb

The Grails Geb Plugin has received a significant update, introducing test fixtures that enable ubiquitous containerized browser testing.

This new approach is now the recommended way to write functional tests in Grails. However, the previous method using WebDriver binaries remains supported for backward compatibility.

Key Features

By extending your test classes with ContainerGebSpec, your tests will automatically leverage a containerized browser provided by Testcontainers. This setup eliminates the need for managing browser versions and ensures consistent test environments.

Requirements

To use ContainerGebSpec, ensure that you have a compatible container runtime installed. Supported options include:

  • Docker Desktop

  • OrbStack (macOS only)

  • Rancher Desktop

  • Podman Desktop

  • Colima (macOS and Linux)

How It Works

Once a compatible container runtime is installed, no additional configuration is needed. Simply extend your test classes with ContainerGebSpec (instead of GebSpec), and the following will happen:

  1. A container will be started automatically when you run your integration tests.

  2. The container will be configured to launch a browser capable of accessing your application under test.

With this setup, you gain the benefits of containerized testing, such as isolation, reproducibility, and reduced setup complexity.

formActionSubmit tag

A new tag formActionSubmit has been added to replace actionSubmit. Dispatching actions via a parameter name on a form submit will be removed in a future version of grails. See ticket #551 for details.

@Scaffold support for Controllers and Services

The @Scaffold annotation was added to customize scaffolding generation for controllers and services.

Bootstrap 5.3.3 support

Bootstrap 5.3.3 support. Saffolding and Fields tags now optionally support boostrap classes.

Prioritization of AutoConfiguration over bean overriding.

The core dependencies of Grails are moving to using @Configuration to better integrate with the Spring Boot ecosystem. Please note that this does mean that some beans are now initialized earlier in the application context lifecycle.

Significant Dependency Removals

With the removal of Micronaut, and the fixes to the asset pipeline plugin, Grails build sizes should now be significantly reduced.

g:form & CSRF protection

The g:form tag now automatically provides csrf protection when Spring Security CSRF is enabled.

1.1.1 Updated Dependencies

Grails 7.0.0-SNAPSHOT ships with the following dependency upgrades:

  • Groovy 4.0.27

  • Spring Framework 6.2.7

  • Spring Boot 3.5.0

  • Gradle 8.14

  • Spock 2.3-groovy-4.0