////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

This section covers all the new features introduced in Grails 7

=== Overview

Grails 7 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 xref:upgrading#upgrading60x[Upgrading from Grails 6 to Grails 7] section.
Notable new features are included below.

=== External Configuration

The https://github.com/sbglasius/external-config[external configuration plugin] is now integrated into Grails.
See the xref:conf.adoc#externalConfiguration[Configuration] section for details.

=== Ubiquitous Containerized Browser Testing with Geb

The https://github.com/apache/grails-core/tree/HEAD/grails-geb#readme[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 https://java.testcontainers.org/[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 https://github.com/grails/grails-gsp/issues/551[#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.
Scaffolding 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.

==== Banner versions and customization (Grails 7.1+)

A Grails banner was introduced in Grails 7 that is displayed in the console on application startup.
From Grails 7.1 onwards, this banner now shows versions of foundational dependencies
and can be xref:conf.adoc#customizing-the-banner[customized].

==== HTTP Client Testing Support (Grails 7.1+)

Grails 7.1 introduces a new `grails-testing-support-http-client` module that simplifies HTTP-based
integration and functional tests.

The module provides an `HttpClientSupport` trait with request helpers for common use cases,
and fluent response assertions via returning a TestHttpResponse wrapper of the actual HttpResponse.

See the xref:testing.adoc#httpClientTestingSupport[HTTP Client Testing Support] section in the Testing chapter
for setup and examples.

==== Custom Test Phases (Grails 7.1+)

Grails now supports defining custom test phases beyond the built-in `unit` and `integration` phases. Using the `testPhases` extension in your `build.gradle`, you can add phases such as `functionalTest`, `smokeTest`, or `performanceTest` - each with its own source set, dependency configurations, and Gradle task.

[source,groovy]
----
testPhases {
    functionalTest { }
}
----

Each phase automatically sets a system property (e.g. `is.grails.functional.test`) that your code can use to detect which test phase is running. The existing `integrationTest` phase is now implemented on top of this same mechanism.

See the xref:testing.adoc#testPhases[Custom Test Phases] section in the Testing chapter for full details.

=== Spring Security Plugins Merged into Grails

The Spring Security plugins &#8212; *Core*, *ACL*, *CAS*, *LDAP*, *OAuth2*, *REST*, and *UI* &#8212; were previously developed and released independently from the https://github.com/apache/grails-spring-security[grails-spring-security] repository.
As of Grails 7 their source has been merged into Grails core, and their reference documentation is now published as part of this guide under the xref:security.adoc#springSecurity[Security > Spring Security] section.

The plugins now share the Grails version and are managed by the Grails BOM, so you no longer need to specify individual plugin versions. They are published under the `org.apache.grails` group (for example, `org.grails.plugins:spring-security-core` is now `org.apache.grails:grails-spring-security`). The underlying Spring Security framework has also been upgraded from 5.8.x to 6.x.

For dependency-coordinate mappings and Spring Security 6.x migration details, see the xref:upgrading#upgrading60x[Upgrading the Spring Security Plugins] section.

NOTE: Documentation for earlier, independently-versioned releases &#8212; including the historical version selector &#8212; remains available at the https://apache.github.io/grails-spring-security/[legacy Spring Security plugin documentation site].

=== Quartz Plugin Merged into Grails

The Quartz plugin was previously developed and released independently from the https://github.com/apache/grails-quartz[grails-quartz] repository.
As of Grails 7 its source has been merged into Grails core, and its reference documentation is now published as part of this guide under the xref:backgroundJobs.adoc#backgroundJobsAdvanced[Background Jobs > Advanced Scheduling] section.

The plugin now shares the Grails version and is managed by the Grails BOM, so you no longer need to specify a plugin version. It is published under the `org.apache.grails` group &#8212; `org.grails.plugins:quartz` is now `org.apache.grails:grails-quartz`.

For dependency-coordinate mappings, see the xref:upgrading#upgrading60x[Upgrading the Quartz Plugin] section.

NOTE: Documentation for earlier, independently-versioned releases remains available at the https://apache.github.io/grails-quartz/[legacy Quartz plugin documentation site].

