10.5.1 Extending the RestfulController super class
-
+
Improve this doc
@@ -761,7 +761,7 @@
Customizing D
-
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
+
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
@@ -812,7 +812,7 @@
Us
10.5.2 Implementing REST Controllers Step by Step
-
+
Improve this doc
@@ -1110,7 +1110,7 @@
Implementing the 'delete' action
10.5.3 Generating a REST controller using scaffolding
10.12 Hypermedia as the Engine of Application State
-
+
Improve this doc
@@ -2165,7 +2165,7 @@
10.12 Hypermedia as the Engine of Application State
10.12.1 HAL Support
-
+
Improve this doc
@@ -2561,7 +2561,7 @@
Customizing Link Rendering
10.12.2 Atom Support
-
+
Improve this doc
@@ -2611,7 +2611,7 @@
10.12.2 Atom Support
10.12.3 Vnd.Error Support
-
+
Improve this doc
@@ -2683,7 +2683,7 @@
10.12.3 Vnd.Error Support
10.13 Customizing Binding of Resources
-
+
Improve this doc
@@ -2766,7 +2766,7 @@
10.13 Customizing Binding of Resources
-
The data binding depends on an instance of the DataBindingSource interface created by an instance of the DataBindingSourceCreator interface. The specific implementation of DataBindingSourceCreator will be selected based on the contentType of the request. Several implementations are provided to handle common content types. The default implementations will be fine for most use cases. The following table lists the content types which are supported by the core framework and which DataBindingSourceCreator implementations are used for each. All of the implementation classes are in the org.grails.databinding.bindingsource package.
+
The data binding depends on an instance of the DataBindingSource interface created by an instance of the DataBindingSourceCreator interface. The specific implementation of DataBindingSourceCreator will be selected based on the contentType of the request. Several implementations are provided to handle common content types. The default implementations will be fine for most use cases. The following table lists the content types which are supported by the core framework and which DataBindingSourceCreator implementations are used for each. All of the implementation classes are in the org.grails.databinding.bindingsource package.
AbstractRequestBodyDataBindingSourceCreator
is an abstract class designed to be extended to simplify writing custom DataBindingSourceCreator classes. Classes which
extend AbstractRequestbodyDatabindingSourceCreator need to implement a method named createBindingSource
which accepts an InputStream as an argument and returns a DataBindingSource as well as implementing the getMimeTypes
@@ -2933,7 +2933,7 @@
By building ontop of these various libraries the The Async features of Grails aim to simplify concurrent programming within the framework and include the concept of Promises and a unified event model.
+
By building on top of these various libraries the Async features of Grails aim to simplify concurrent programming within the framework, include the concept of Promises, and a unified event model.
-
In general since the Reactive programming model is an evolving space Grails tries to provide generic support for integrating a range of asynchronous libraries and doesn’t recommend any single library as they all have various advantages and disadvantages.
+
In general, since the Reactive programming model is an evolving space, Grails tries to provide generic support for integrating a range of asynchronous libraries and doesn’t recommend any single library as they all have various advantages and disadvantages.
For more information on Asynchronous programming with Grails see the user guide for the Grails Asynchronous Framework.
diff --git a/snapshot/guide/commandLine.html b/snapshot/guide/commandLine.html
index 7cd30ea00f1..82da9496a13 100644
--- a/snapshot/guide/commandLine.html
+++ b/snapshot/guide/commandLine.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 5 The Command Line 4.0.13
+ 5 The Command Line 5.0.1
@@ -44,7 +44,7 @@
Plugins and applications that need to define template generation tasks can do so using scripts. A example of this is the Scaffolding plugin which defines the generate-all and generate-controllers commands.
-
Every Grails script implements the TemplateRenderer interface which makes it trivial to render templates to the users project workspace.
+
Every Grails script implements the TemplateRenderer interface which makes it trivial to render templates to the users project workspace.
The following is an example of the create-script command written in Groovy:
@@ -483,7 +483,7 @@
Template Generation
The "model"
-
Executing the model method with a Class/String/File/Resource will return an instance of Model. The model contains several properties that can help you generate code.
+
Executing the model method with a Class/String/File/Resource will return an instance of Model. The model contains several properties that can help you generate code.
Example:
@@ -507,7 +507,7 @@
The "model"
Working with files
-
All scripts have access to methods on the FileSystemInteraction class. It contains helpful methods to copy, delete, and create files.
+
All scripts have access to methods on the FileSystemInteraction class. It contains helpful methods to copy, delete, and create files.
@@ -515,7 +515,7 @@
Working with files
5.3 Creating Custom Commands
-
+
Improve this doc
@@ -604,7 +604,7 @@
5.3 Creating Custom Commands
5.4 Re-using Grails scripts
-
+
Improve this doc
@@ -656,14 +656,14 @@
Invoking Ant
5.5 Building with Gradle
-
+
Improve this doc
-
Grails 3.1 uses the Gradle Build System for build related tasks such as compilation, runnings tests and producing binary distributions of your project. It is recommended to use Gradle 2.2 or above with Grails 3.1.
+
Since Grails 3.1 the Gradle Build System is used for build related tasks such as compilation, runnings tests and producing binary distributions of your project. It is recommended to use Gradle 2.2 or above with Grails 3.1 (and higher).
The build is defined by the build.gradle file which specifies the version of your project, the dependencies of the project and the repositories where to find those dependencies (amongst other things).
@@ -678,7 +678,7 @@
5.5 Building with Gradle
-
You can invoke Gradle directly using the gradle command and use your own local version of Gradle, however you will need Gradle 2.2 or above to work with Grails 3.0:
+
You can invoke Gradle directly using the gradle command and use your own local version of Gradle, however you will need Gradle 2.2 or above to work with Grails 3.0 (and higher):
@@ -690,7 +690,7 @@
5.5 Building with Gradle
5.5.1 Defining Dependencies with Gradle
-
+
Improve this doc
@@ -719,7 +719,8 @@
5.5.1 Defining Dependencies with Gradle
runtime 'org.grails.plugins:asset-pipeline'
runtime 'org.grails.plugins:scaffolding'
- testCompile 'org.grails:grails-plugin-testing'
+ testCompile "org.grails:grails-gorm-testing-support"
+ testCompile "org.grails:grails-web-testing-support"
testCompile 'org.grails.plugins:geb'// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
@@ -747,7 +748,7 @@
If you want to read runtime configuration settings, i.e. those defined in application.yml, use the grailsApplication object, which is available as a variable in controllers and tag libraries:
+
If you want to read runtime configuration settings, i.e. those defined in application.yml, use the grailsApplication object, which is available as a variable in controllers and tag libraries:
@@ -333,7 +333,7 @@
Accessing Configuration
-
The config property of the grailsApplication object is an instance of the Config interface and provides a number of useful methods to read the configuration of the application.
+
The config property of the grailsApplication object is an instance of the Config interface and provides a number of useful methods to read the configuration of the application.
In particular, the getProperty method (seen above) is useful for efficiently retrieving configuration properties, while specifying the property type (the default type is String) and/or providing a default fallback value.
@@ -359,7 +359,7 @@
Accessing Configuration
-
Notice that the Config instance is a merged configuration based on Spring’s PropertySource concept and reads configuration from the environment, system properties and the local application configuration merging them into a single object.
+
Notice that the Config instance is a merged configuration based on Spring’s PropertySource concept and reads configuration from the environment, system properties and the local application configuration merging them into a single object.
GrailsApplication can be easily injected into services and other Grails artifacts:
@@ -382,7 +382,7 @@
Accessing Configuration
GrailsConfigurationAware Interface
-
Accessing configuration dynamically at runtime can have a small effect on application performance. An alternative approach is to implement the GrailsConfigurationAware interface, which provides a setConfiguration method that accepts the application configuration as a parameter when the class is initialized. You can then assign relevant configuration properties to instance properties on the class for later usage.
+
Accessing configuration dynamically at runtime can have a small effect on application performance. An alternative approach is to implement the GrailsConfigurationAware interface, which provides a setConfiguration method that accepts the application configuration as a parameter when the class is initialized. You can then assign relevant configuration properties to instance properties on the class for later usage.
The Config instance has the same properties and usage as the injected GrailsApplication config object. Here is the service class from the previous example, using GrailsConfigurationAware instead of injecting GrailsApplication:
@@ -410,7 +410,7 @@
GrailsConfigurationAware Interface<
Spring Value Annotation
-
You can use Spring’s Value annotation to inject configuration values:
+
You can use Spring’s Value annotation to inject configuration values:
grails.mime.types - A map of supported mime types used for Content Negotiation.
-
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
+
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
grails.views.gsp.sitemesh.preprocess - Determines whether SiteMesh preprocessing happens. Disabling this slows down page rendering, but if you need SiteMesh to parse the generated HTML from a GSP view then disabling it is the right option. Don’t worry if you don’t understand this advanced property: leave it set to true.
@@ -552,36 +552,24 @@
Runtime settings
4.1.3 Logging
-
+
Improve this doc
-
Since Grails 3.0, logging is handled by the Logback logging framework and can be configured with the grails-app/conf/logback.groovy file.
-
-
-
-
-
-
-
-
-If you prefer XML you can replace the logback.groovy file with a logback.xml file instead.
-
-
-
+
Since Grails 3.0, logging is handled by the Logback logging framework and can be configured with the grails-app/conf/logback.xml file.
-
For more information on configuring logging refer to the Logback documentation on the subject.
+
For more information on configuring logging refer to the Logback documentation on the subject.
4.1.3.1 Logger Names
-
+
Improve this doc
@@ -699,7 +687,7 @@
4.1.3.1 Logger Names
4.1.3.2 Masking Request Parameters From Stacktrace Logs
Every new Grails application features an Application class within the grails-app/init directory.
-
The Application class subclasses the GrailsAutoConfiguration class and features a static void main method, meaning it can be run as a regular application.
+
The Application class subclasses the GrailsAutoConfiguration class and features a static void main method, meaning it can be run as a regular application.
4.2.1 Executing the Application Class
-
+
Improve this doc
@@ -903,7 +891,7 @@
4.2.1 Executing the Application Class
4.2.2 Customizing the Application Class
-
+
Improve this doc
@@ -933,7 +921,7 @@
Customizing Scanning
Registering Additional Beans
-
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
+
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
@@ -953,14 +941,14 @@
Registering Additional Beans
4.2.3 The Application LifeCycle
-
+
Improve this doc
-
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
+
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
This means that the Application class can be used to perform the same functions as a plugin. You can override the regular plugins hooks such as doWithSpring, doWithApplicationContext and so on by overriding the appropriate method:
@@ -984,7 +972,7 @@
4.2.3 The Application LifeCycle
4.3 Environments
-
+
Improve this doc
@@ -1087,7 +1075,7 @@
Packaging and Running
Programmatic Environment Detection
-
Within your code, such as in a Gant script or a bootstrap class you can detect the environment using the Environment class:
+
Within your code, such as in a Gant script or a bootstrap class you can detect the environment using the Environment class:
@@ -1150,7 +1138,7 @@
Generic Per Environment Execution4.4 The DataSource
-
+
Improve this doc
@@ -1393,7 +1381,7 @@
More on dbCreate
4.4.1 DataSources and Environments
-
+
Improve this doc
@@ -1429,7 +1417,7 @@
4.4.1 DataSources and Environments
4.4.2 Automatic Database Migration
-
+
Improve this doc
@@ -1481,7 +1469,7 @@
4.4.2 Automatic Database Migration
4.4.3 Transaction-aware DataSource Proxy
-
+
Improve this doc
@@ -1498,7 +1486,7 @@
4.4.3 Transaction-aware DataSource Prox
4.4.4 Database Console
-
+
Improve this doc
@@ -1508,14 +1496,14 @@
4.4.4 Database Console
The H2 database console is a convenient feature of H2 that provides a web-based interface to any database that you have a JDBC driver for, and it’s very useful to view the database you’re developing against. It’s especially useful when running against an in-memory database.
The BE1PC implementation was added in Grails 2.3.6. . Before this change additional datasources didn’t take part in transactions initiated in Grails. The transactions in additional datasources were basically in auto commit mode. In some cases this might be the wanted behavior. One reason might be performance: on the start of each new transaction, the BE1PC transaction manager creates a new transaction to each datasource. It’s possible to leave an additional datasource out of the BE1PC transaction manager by setting transactional = false in the respective configuration block of the additional dataSource. Datasources with readOnly = true will also be left out of the chained transaction manager (since 2.3.7).
-
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
+
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
You can exclude transaction manager beans from the BE1PC implementation with this configuration option:
@@ -1843,7 +1831,7 @@
XA and Two-phase Commit
When the Best Efforts 1PC pattern isn’t suitable for handling transactions across multiple transactional resources (not only datasources), there are several options available for adding XA/2PC support to Grails applications.
-
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
+
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
@@ -1851,7 +1839,7 @@
XA and Two-phase Commit
4.5 Versioning
-
+
Improve this doc
@@ -1860,7 +1848,7 @@
4.5 Versioning
Detecting Versions at Runtime
-
You can detect the application version using Grails' support for application metadata using the GrailsApplication class. For example within controllers there is an implicit grailsApplication variable that can be used:
+
You can detect the application version using Grails' support for application metadata using the GrailsApplication class. For example within controllers there is an implicit grailsApplication variable that can be used:
Before installing Grails 4.0.13 you will need as a minimum a Java Development Kit (JDK) installed version 1.8 or above. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.
+
Before installing Grails 5.0.1 you will need as a minimum a Java Development Kit (JDK) installed version 1.8. The most recent supported version of the JDK is 11. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.
To automate the installation of Grails we recommend SDKMAN which greatly simplifies installing and managing multiple Grails versions.
-
On some platforms (for example OS X) the Java installation is automatically detected. However in many cases you will want to manually configure the location of Java. For example, if you’re using bash or another variant of the Bourne Shell:
+
On some platforms (for example macOS) the Java installation is automatically detected. However in many cases you will want to manually configure the location of Java. For example, if you’re using bash or another variant of the Bourne Shell:
@@ -239,7 +239,7 @@
2.1 Installation Requirements
2.2 Downloading and Installing
-
+
Improve this doc
@@ -271,7 +271,7 @@
Install with SDKMAN
-
sdk install grails 4.0.13
+
sdk install grails 5.0.1
@@ -307,12 +307,20 @@
Unix/Linux
-
-
===Windows
-** Copy the path to the bin directory inside the grails folder you have downloaded, for example,
----
-C:/path_to_grails/bin
----
+
+
+
Windows
+
+
+
+
Copy the path to the bin directory inside the grails folder you have downloaded, for example,
+
+
+
+
+
+
C:/path_to_grails/bin
+
@@ -321,11 +329,11 @@
Unix/Linux
-
-
-
Start + R
+
+
+
Start + R
+
-
@@ -341,7 +349,7 @@
Unix/Linux
-
Grails version: 4.0.13
+
Grails version: 5.0.1
@@ -352,7 +360,7 @@
Unix/Linux
2.3 Creating an Application
-
+
Improve this doc
@@ -387,7 +395,7 @@
2.3 Creating an Application
2.4 A Hello World Example
-
+
Improve this doc
@@ -517,7 +525,7 @@
2.4 A Hello World Example
2.5 Using Interactive Mode
-
+
Improve this doc
@@ -539,7 +547,7 @@
2.5 Using Interactive Mode
2.6 Getting Set Up in an IDE
-
+
Improve this doc
@@ -548,7 +556,7 @@
2.6 Getting Set Up in an IDE
IntelliJ IDEA
-
IntelliJ IDEA is an excellent IDE for Grails 4.0 development. It comes in 2 editions, the free community edition and the paid-for ultimate edition.
+
IntelliJ IDEA is an excellent IDE for Grails 5.0 development. It comes in 2 editions, the free community edition and the paid-for ultimate edition.
The community edition can be used for most things, although GSP syntax higlighting is only part of the ultimate edition
@@ -566,7 +574,7 @@
IntelliJ IDEA
-
To get started with Intellij IDEA and Grails 4.0 simply go to File / Open and point IDEA at your build.gradle file to import and configure the project.
+
To get started with Intellij IDEA and Grails 5.0 simply go to File / Open and point IDEA at your build.gradle file to import and configure the project.
@@ -599,7 +607,7 @@
TextMate, Sublime, VIM etc.
2.7 Convention over Configuration
-
+
Improve this doc
@@ -660,7 +668,7 @@
2.7 Convention over Configuration
2.8 Running and Debugging an Application
-
+
Improve this doc
@@ -716,7 +724,7 @@
2.8 Running and Debugging an Applicati
2.9 Testing an Application
-
+
Improve this doc
@@ -738,7 +746,7 @@
2.9 Testing an Application
2.10 Deploying an Application
-
+
Improve this doc
@@ -775,6 +783,18 @@
2.10 Deploying an Application
ext['tomcat.version'] = '7.0.59'
+
+
+
+
+
+
+
+Grails 5 contains dependencies that requirejavax.el-api:3.0 (eg.: datastore-gorm:7.x, spring-boot:2.x) which is only supported starting from Tomcat 8.x+, based on the tomcat version table!
+
+
+
+
Unlike most scripts which default to the development environment unless overridden, the war command runs in the production environment by default. You can override this like any script by specifying the environment name, for example:
The most common place that you need messages is inside the view. Use the message tag for this:
+
The most common place that you need messages is inside the view. Use the message tag for this:
@@ -388,14 +388,14 @@
16.4 Scaffolding and i18n
-
+
Improve this doc
-
Grails scaffolding templates for controllers and views are fully i18n-aware. The GSPs use the message tag for labels, buttons etc. and controller flash messages use i18n to resolve locale-specific messages.
+
Grails scaffolding templates for controllers and views are fully i18n-aware. The GSPs use the message tag for labels, buttons etc. and controller flash messages use i18n to resolve locale-specific messages.
The scaffolding includes locale specific labels for domain classes and domain fields. For example, if you have a Book domain class with a title field:
This section covers all the new features introduced in Grails 4.
+
This section covers all the new features introduced in Grails 5
+
+
+
Overview
+
+
This release includes support for Apache Groovy 3, Micronaut framework 3, Gradle 7, Spring Boot 2.5, Spring framework 5.3, and Spock 2.0.
+
+
+
Apache Groovy 3 is a major highlight of this release. It comes with a brand new Parrot parser and a bunch of new features and capabilities. The Parrot parser supports additional syntax and language features, such as lambda expressions, default methods with interfaces, and a lot more. In addition, several new extension methods are added to existing Java classes. See the release notes for Groovy 3.0 for details.
+
+
+
Grails framework 5 updates to Spring 5.3.10 and Spring Boot 2.5.5. We strongly recommend checking the following Spring technologies release notes for more information.
Grails framework 5 is built with Groovy 3.0.7, which requires JDK 8 as the minimum version of JRE. We have tested most Grails projects up to JDK 14.
+
+
+
+
Important Changes
+
+
Deprecating ‘dot’-Based Navigation
+
+
The ‘dot’-based navigation to Grails config is deprecated and will be removed in the future.
+
+
+
We request that you update your plugins to use configuration beans @ConfigurationProperties or @Value, or access configuration settings using grailsApplication.config.getProperty(‘a.b.c’, String) instead of grailsApplication.config.a.b.c. For more information, read the documentation at Creating and Installing Plugins.
+
+
+
Default Autowire By Type
+
+
In previous versions, the beans inside the Grails DataService were autowire by name, but this is changed to autowire by type in Grails framework 5. Use the Spring @Qualifier annotation to autowire by name. For details, see the Spring documentation for Fine-tuning Annotation Based Autowiring with Qualifiers.
+
+
+
+
+
Grails Gradle Plugin
+
+
The Grails Gradle Plugin is moved out of grails-core and may follow separate versioning, so you should decouple the grailsVersion Gradle property from grailsGradlePluginVersion in existing applications.
+
+
+
+
Grails Gradle Publish Plugin Removed
+
+
The Grails Gradle Publish plugin used the Bintray API to publish artifacts. However, after the JFrog shutdown of Bintray, this stopped working. We have removed this plugin from the new Grails Plugin applications.
+
+
1.1.1 Updated Dependencies
-
+
Improve this doc
-
Grails 4.0.13 ships with the following dependency upgrades:
+
Grails 5.0.1 ships with the following dependency upgrades:
-
Groovy 2.5.14
+
Groovy 3.0.7
+
+
+
Micronaut 3
+
+
+
Micronaut for Spring 4
+
+
+
GORM 7.1.0
-
GORM 7 and Hibernate 5.4 (now the default version of Hibernate for new applications)
+
Spring Framework 5.3
-
Spring Framework 5.1.20
+
Spring Boot 2.5
-
Spring Boot 2.1.18
+
Gradle 7.2
-
Gradle 5.6.4
+
Spock 2.0-groovy-3.0
-
Spock 1.3
+
Grails Testing Support 2.2.0
-
1.1.2 Micronaut Parent Context
-
-
-
- Improve this doc
-
-
-
-
-
-
Micronaut is now the parent application context of Grails thus allowing using many Micronaut features including the Micronaut HTTP Client and Kafka Client.
-
-
-
Micronaut has also been used to improve startup and reduce overall memory consumption of Grails applications (along with associated improvements in Spring Boot 2.1).
diff --git a/snapshot/guide/pages/aHelloWorldExample.html b/snapshot/guide/pages/aHelloWorldExample.html
index 4d4ecc83713..a8f34998220 100644
--- a/snapshot/guide/pages/aHelloWorldExample.html
+++ b/snapshot/guide/pages/aHelloWorldExample.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 2.4 A Hello World Example 4.0.13
+ 2.4 A Hello World Example 5.0.1
@@ -44,7 +44,7 @@
Spring Boot Actuator endpoints allow you to monitor and interact with your application. Spring Boot includes a number of built-in endpoints. For example the health endpoint provides basic application health information.
+
Spring Boot Actuator endpoints allow you to monitor and interact with your application. Spring Boot includes a number of built-in endpoints. For example the health endpoint provides basic application health information.
These endpoints are disabled by default since Grails 3.1.8.
The @Enhances annotation defines the types of artefacts that the trait should be applied to.
-
As an alternative to using the @Enhances annotation above, you can implement a TraitInjector to tell Grails which artefacts you want to inject the trait into at compile time:
+
As an alternative to using the @Enhances annotation above, you can implement a TraitInjector to tell Grails which artefacts you want to inject the trait into at compile time:
@@ -197,7 +197,7 @@
18.6 Adding Methods at Compile Time
Applying traits conditionally
-
A TraitInjector implementation can also implement the SupportsClassNode interface to apply traits to only those artefacts which satisfy a custom requirement.
+
A TraitInjector implementation can also implement the SupportsClassNode interface to apply traits to only those artefacts which satisfy a custom requirement.
For example, if a trait should only be applied if the target artefact class has a specific annotation, it can be done as below
Every new Grails application features an Application class within the grails-app/init directory.
-
The Application class subclasses the GrailsAutoConfiguration class and features a static void main method, meaning it can be run as a regular application.
+
The Application class subclasses the GrailsAutoConfiguration class and features a static void main method, meaning it can be run as a regular application.
4.2.1 Executing the Application Class
-
+
Improve this doc
@@ -205,7 +205,7 @@
4.2.1 Executing the Application Class
4.2.2 Customizing the Application Class
-
+
Improve this doc
@@ -235,7 +235,7 @@
Customizing Scanning
Registering Additional Beans
-
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
+
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
@@ -255,14 +255,14 @@
Registering Additional Beans
4.2.3 The Application LifeCycle
-
+
Improve this doc
-
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
+
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
This means that the Application class can be used to perform the same functions as a plugin. You can override the regular plugins hooks such as doWithSpring, doWithApplicationContext and so on by overriding the appropriate method:
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
+
The Application class also implements the GrailsApplicationLifeCycle interface which all plugins implement.
This means that the Application class can be used to perform the same functions as a plugin. You can override the regular plugins hooks such as doWithSpring, doWithApplicationContext and so on by overriding the appropriate method:
As a plugin developer, it can be important for you to find out about what domain classes, controllers, or other types of artefact are available in an application. For example, the Elasticsearch plugin needs to know what domain classes exist so it can check them for any searchable properties and index the appropriate ones. So how does it do it? The answer lies with the grailsApplication object, and instance of GrailsApplication that’s available automatically in controllers and GSPs and can be injected everywhere else.
+
As a plugin developer, it can be important for you to find out about what domain classes, controllers, or other types of artefact are available in an application. For example, the Elasticsearch plugin needs to know what domain classes exist so it can check them for any searchable properties and index the appropriate ones. So how does it do it? The answer lies with the grailsApplication object, and instance of GrailsApplication that’s available automatically in controllers and GSPs and can be injected everywhere else.
The grailsApplication object has several important properties and methods for querying artefacts. Probably the most common is the one that gives you all the classes of a particular artefact type:
@@ -238,7 +238,7 @@
18.10.1 Asking About Available Artefacts
-
You need to be aware that the objects returned by these properties are not instances of Class. Instead, they are instances of GrailsClass that has some particularly useful properties and methods, including one for the underlying Class:
+
You need to be aware that the objects returned by these properties are not instances of Class. Instead, they are instances of GrailsClass that has some particularly useful properties and methods, including one for the underlying Class:
@@ -277,7 +277,7 @@
18.10.1 Asking About Available Artefacts
18.10.2 Adding Your Own Artefact Types
-
+
Improve this doc
@@ -298,10 +298,10 @@
18.10.2 Adding Your Own Artefact Types
The artefacts list can contain either handler classes (as above) or instances of handlers.
-
So, what does an artefact handler look like? Well, put simply it is an implementation of the ArtefactHandler interface. To make life a bit easier, there is a skeleton implementation that can readily be extended: ArtefactHandlerAdapter.
+
So, what does an artefact handler look like? Well, put simply it is an implementation of the ArtefactHandler interface. To make life a bit easier, there is a skeleton implementation that can readily be extended: ArtefactHandlerAdapter.
-
In addition to the handler itself, every new artefact needs a corresponding wrapper class that implements GrailsClass. Again, skeleton implementations are available such as AbstractInjectableGrailsClass, which is particularly useful as it turns your artefact into a Spring bean that is auto-wired, just like controllers and services.
+
In addition to the handler itself, every new artefact needs a corresponding wrapper class that implements GrailsClass. Again, skeleton implementations are available such as AbstractInjectableGrailsClass, which is particularly useful as it turns your artefact into a Spring bean that is auto-wired, just like controllers and services.
The best way to understand how both the handler and wrapper classes work is to look at the Quartz plugin:
diff --git a/snapshot/guide/pages/atom.html b/snapshot/guide/pages/atom.html
index 80bc84d5c57..94ec9627028 100644
--- a/snapshot/guide/pages/atom.html
+++ b/snapshot/guide/pages/atom.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 10.12.2 Atom Support 4.0.13
+ 10.12.2 Atom Support 5.0.1
@@ -44,7 +44,7 @@
Another great feature of URL mappings is that they automatically customize the behaviour of the link tag so that changing the mappings don’t require you to go and change all of your links.
+
Another great feature of URL mappings is that they automatically customize the behaviour of the link tag so that changing the mappings don’t require you to go and change all of your links.
This is done through a URL re-writing technique that reverse engineers the links from the URL mappings. So given a mapping such as the blog one from an earlier section:
The data binding depends on an instance of the DataBindingSource interface created by an instance of the DataBindingSourceCreator interface. The specific implementation of DataBindingSourceCreator will be selected based on the contentType of the request. Several implementations are provided to handle common content types. The default implementations will be fine for most use cases. The following table lists the content types which are supported by the core framework and which DataBindingSourceCreator implementations are used for each. All of the implementation classes are in the org.grails.databinding.bindingsource package.
+
The data binding depends on an instance of the DataBindingSource interface created by an instance of the DataBindingSourceCreator interface. The specific implementation of DataBindingSourceCreator will be selected based on the contentType of the request. Several implementations are provided to handle common content types. The default implementations will be fine for most use cases. The following table lists the content types which are supported by the core framework and which DataBindingSourceCreator implementations are used for each. All of the implementation classes are in the org.grails.databinding.bindingsource package.
AbstractRequestBodyDataBindingSourceCreator
is an abstract class designed to be extended to simplify writing custom DataBindingSourceCreator classes. Classes which
extend AbstractRequestbodyDatabindingSourceCreator need to implement a method named createBindingSource
which accepts an InputStream as an argument and returns a DataBindingSource as well as implementing the getMimeTypes
diff --git a/snapshot/guide/pages/build.html b/snapshot/guide/pages/build.html
index 92d4b025d9e..40e1a9506c5 100644
--- a/snapshot/guide/pages/build.html
+++ b/snapshot/guide/pages/build.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
-
22.2 Build From Source and Run Tests 4.0.13
+ 22.2 Build From Source and Run Tests 5.0.1
@@ -44,7 +44,7 @@
grails.mime.types - A map of supported mime types used for Content Negotiation.
-
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
+
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
grails.views.gsp.sitemesh.preprocess - Determines whether SiteMesh preprocessing happens. Disabling this slows down page rendering, but if you need SiteMesh to parse the generated HTML from a GSP view then disabling it is the right option. Don’t worry if you don’t understand this advanced property: leave it set to true.
If you want to read runtime configuration settings, i.e. those defined in application.yml, use the grailsApplication object, which is available as a variable in controllers and tag libraries:
+
If you want to read runtime configuration settings, i.e. those defined in application.yml, use the grailsApplication object, which is available as a variable in controllers and tag libraries:
@@ -277,7 +277,7 @@
Accessing Configuration
-
The config property of the grailsApplication object is an instance of the Config interface and provides a number of useful methods to read the configuration of the application.
+
The config property of the grailsApplication object is an instance of the Config interface and provides a number of useful methods to read the configuration of the application.
In particular, the getProperty method (seen above) is useful for efficiently retrieving configuration properties, while specifying the property type (the default type is String) and/or providing a default fallback value.
@@ -303,7 +303,7 @@
Accessing Configuration
-
Notice that the Config instance is a merged configuration based on Spring’s PropertySource concept and reads configuration from the environment, system properties and the local application configuration merging them into a single object.
+
Notice that the Config instance is a merged configuration based on Spring’s PropertySource concept and reads configuration from the environment, system properties and the local application configuration merging them into a single object.
GrailsApplication can be easily injected into services and other Grails artifacts:
@@ -326,7 +326,7 @@
Accessing Configuration
GrailsConfigurationAware Interface
-
Accessing configuration dynamically at runtime can have a small effect on application performance. An alternative approach is to implement the GrailsConfigurationAware interface, which provides a setConfiguration method that accepts the application configuration as a parameter when the class is initialized. You can then assign relevant configuration properties to instance properties on the class for later usage.
+
Accessing configuration dynamically at runtime can have a small effect on application performance. An alternative approach is to implement the GrailsConfigurationAware interface, which provides a setConfiguration method that accepts the application configuration as a parameter when the class is initialized. You can then assign relevant configuration properties to instance properties on the class for later usage.
The Config instance has the same properties and usage as the injected GrailsApplication config object. Here is the service class from the previous example, using GrailsConfigurationAware instead of injecting GrailsApplication:
@@ -354,7 +354,7 @@
GrailsConfigurationAware Interface<
Spring Value Annotation
-
You can use Spring’s Value annotation to inject configuration values:
+
You can use Spring’s Value annotation to inject configuration values:
grails.mime.types - A map of supported mime types used for Content Negotiation.
-
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
+
grails.serverURL - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See createLink. Also used by redirects.
grails.views.gsp.sitemesh.preprocess - Determines whether SiteMesh preprocessing happens. Disabling this slows down page rendering, but if you need SiteMesh to parse the generated HTML from a GSP view then disabling it is the right option. Don’t worry if you don’t understand this advanced property: leave it set to true.
@@ -496,36 +496,24 @@
Runtime settings
4.1.3 Logging
-
+
Improve this doc
-
Since Grails 3.0, logging is handled by the Logback logging framework and can be configured with the grails-app/conf/logback.groovy file.
-
-
-
-
-
-
-
-
-If you prefer XML you can replace the logback.groovy file with a logback.xml file instead.
-
-
-
+
Since Grails 3.0, logging is handled by the Logback logging framework and can be configured with the grails-app/conf/logback.xml file.
-
For more information on configuring logging refer to the Logback documentation on the subject.
+
For more information on configuring logging refer to the Logback documentation on the subject.
4.1.3.1 Logger Names
-
+
Improve this doc
@@ -643,7 +631,7 @@
4.1.3.1 Logger Names
4.1.3.2 Masking Request Parameters From Stacktrace Logs
servletContext - Also known as application scope, this scope lets you share state across the entire web application. The servletContext is an instance of ServletContext
+
servletContext - Also known as application scope, this scope lets you share state across the entire web application. The servletContext is an instance of ServletContext
-
session - The session allows associating state with a given user and typically uses cookies to associate a session with a client. The session object is an instance of HttpSession
+
session - The session allows associating state with a given user and typically uses cookies to associate a session with a client. The session object is an instance of HttpSession
-
request - The request object allows the storage of objects for the current request only. The request object is an instance of HttpServletRequest
+
request - The request object allows the storage of objects for the current request only. The request object is an instance of HttpServletRequest
params - Mutable map of incoming request query string or POST parameters
@@ -340,7 +340,7 @@
Available Scopes
Accessing Scopes
-
Scopes can be accessed using the variable names above in combination with Groovy’s array index operator, even on classes provided by the Servlet API such as the HttpServletRequest:
+
Scopes can be accessed using the variable names above in combination with Groovy’s array index operator, even on classes provided by the Servlet API such as the HttpServletRequest:
@@ -453,7 +453,7 @@
Scoped Controllers
8.1.3 Models and Views
-
+
Improve this doc
@@ -484,7 +484,7 @@
Returning the Model
-
A more advanced approach is to return an instance of the Spring ModelAndView class:
+
A more advanced approach is to return an instance of the Spring ModelAndView class:
The BindUsing annotation may be used to define a custom binding mechanism for a particular field in a class. Any time data binding is being applied to the field the closure value of the annotation will be invoked with 2 arguments. The first argument is the object that data binding is being applied to and the second argument is DataBindingSource which is the data source for the data binding. The value returned from the closure will be bound to the property. The following example would result in the upper case version of the name value in the source being applied to the name field during data binding.
+
The BindUsing annotation may be used to define a custom binding mechanism for a particular field in a class. Any time data binding is being applied to the field the closure value of the annotation will be invoked with 2 arguments. The first argument is the object that data binding is being applied to and the second argument is DataBindingSource which is the data source for the data binding. The value returned from the closure will be bound to the property. The following example would result in the upper case version of the name value in the source being applied to the name field during data binding.
@@ -1486,7 +1486,7 @@
The BindUsing Annotation
-
The BindUsing annotation may be used to define a custom binding mechanism for all of the fields on a particular class. When the annotation is applied to a class, the value assigned to the annotation should be a class which implements the BindingHelper interface. An instance of that class will be used any time a value is bound to a property in the class that this annotation has been applied to.
+
The BindUsing annotation may be used to define a custom binding mechanism for all of the fields on a particular class. When the annotation is applied to a class, the value assigned to the annotation should be a class which implements the BindingHelper interface. An instance of that class will be used any time a value is bound to a property in the class that this annotation has been applied to.
@@ -1501,8 +1501,8 @@
The BindUsing Annotation
The BindInitializer Annotation
-
The BindInitializer annotation may be used to initialize an associated field in a class if it is undefined.
-Unlike the BindUsing annotation, databinding will continue binding all nested properties on this association.
+
The BindInitializer annotation may be used to initialize an associated field in a class if it is undefined.
+Unlike the BindUsing annotation, databinding will continue binding all nested properties on this association.
@@ -1540,7 +1540,7 @@
The BindInitializer Annotation
Custom Data Converters
-
The binder will do a lot of type conversion automatically. Some applications may want to define their own mechanism for converting values and a simple way to do this is to write a class which implements ValueConverter and register an instance of that class as a bean in the Spring application context.
+
The binder will do a lot of type conversion automatically. Some applications may want to define their own mechanism for converting values and a simple way to do this is to write a class which implements ValueConverter and register an instance of that class as a bean in the Spring application context.
@@ -1604,7 +1604,7 @@
Custom Data Converters
Date Formats For Data Binding
-
A custom date format may be specified to be used when binding a String to a Date value by applying the BindingFormat annotation to a Date field.
+
A custom date format may be specified to be used when binding a String to a Date value by applying the BindingFormat annotation to a Date field.
@@ -1651,7 +1651,7 @@
Date Formats For Data Binding
Custom Formatted Converters
-
You may supply your own handler for the BindingFormat annotation by writing a class which implements the FormattedValueConverter interface and registering an instance of that class as a bean in the Spring application context. Below is an example of a trivial custom String formatter that might convert the case of a String based on the value assigned to the BindingFormat annotation.
+
You may supply your own handler for the BindingFormat annotation by writing a class which implements the FormattedValueConverter interface and registering an instance of that class as a bean in the Spring application context. Below is an example of a trivial custom String formatter that might convert the case of a String based on the value assigned to the BindingFormat annotation.
@@ -1768,7 +1768,7 @@
Structured Data Binding Editors
A Gadget has 2 Shape fields. A Shape has an area property. It may be that the application wants to accept request parameters like width and height and use those to calculate the area of a Shape at binding time. A structured binding editor is well suited for that.
The DataBindingListener interface provides a mechanism for listeners to be notified of data binding events. The interface looks like this:
+
The DataBindingListener interface provides a mechanism for listeners to be notified of data binding events. The interface looks like this:
@@ -1906,7 +1906,7 @@
Data Binding Event Listeners
-
Any bean in the Spring application context which implements that interface will automatically be registered with the data binder. The DataBindingListenerAdapter class implements the DataBindingListener interface and provides default implementations for all of the methods in the interface so this class is well suited for subclassing so your listener class only needs to provide implementations for the methods your listener is interested in.
+
Any bean in the Spring application context which implements that interface will automatically be registered with the data binder. The DataBindingListenerAdapter class implements the DataBindingListener interface and provides default implementations for all of the methods in the interface so this class is well suited for subclassing so your listener class only needs to provide implementations for the methods your listener is interested in.
@@ -1941,7 +1941,7 @@
Using The Data Binder Directly
-
An instance of the data binder is in the Spring application context with a bean name of grailsWebDataBinder. That bean implements the DataBinder interface. The following code demonstrates using the data binder directly.
+
An instance of the data binder is in the Spring application context with a bean name of grailsWebDataBinder. That bean implements the DataBinder interface. The following code demonstrates using the data binder directly.
grails-app/services/bindingdmeo/WidgetService
@@ -1963,7 +1963,7 @@
Using The Data Binder Directly
-
See the DataBinder documentation for more information about overloaded versions
+
See the DataBinder documentation for more information about overloaded versions
of the bind method.
@@ -2033,7 +2033,7 @@
Data Binding and Security Concerns<
8.1.6 Responding with JSON
-
+
Improve this doc
@@ -2076,7 +2076,7 @@
Using the respond method to ou
-
The respond method will then look for an appriopriate Renderer for the object and the calculated media type from the RendererRegistry.
+
The respond method will then look for an appriopriate Renderer for the object and the calculated media type from the RendererRegistry.
Grails includes a number of pre-configured Renderer implementations that will produce default representations of JSON responses for the argument passed to respond. For example going to the /book.json URI will produce JSON such as:
@@ -2285,7 +2285,7 @@
Using the render method to outp
8.1.7 More on JSONBuilder
-
+
Improve this doc
@@ -2295,14 +2295,14 @@
8.1.7 More on JSONBuilder
The previous section on XML and JSON responses covered simplistic examples of rendering XML and JSON responses. Whilst the XML builder used by Grails is the standard XmlSlurper found in Groovy.
Grails supports file uploads using Spring’s MultipartHttpServletRequest interface. The first step for file uploading is to create a multipart form like this:
+
Grails supports file uploads using Spring’s MultipartHttpServletRequest interface. The first step for file uploading is to create a multipart form like this:
@@ -2338,7 +2338,7 @@
Programmatic File Uploads
The uploadForm tag conveniently adds the enctype="multipart/form-data" attribute to the standard <g:form> tag.
-
There are then a number of ways to handle the file upload. One is to work with the Spring MultipartFile instance directly:
+
There are then a number of ways to handle the file upload. One is to work with the Spring MultipartFile instance directly:
@@ -2356,7 +2356,7 @@
Programmatic File Uploads
-
This is convenient for doing transfers to other destinations and manipulating the file directly as you can obtain an InputStream and so on with the MultipartFile interface.
+
This is convenient for doing transfers to other destinations and manipulating the file directly as you can obtain an InputStream and so on with the MultipartFile interface.
@@ -2451,7 +2451,7 @@
Increase Upload Max File Size
8.1.10 Command Objects
-
+
Improve this doc
@@ -2808,14 +2808,14 @@
Working with Lists of Command Ob
8.1.11 Handling Duplicate Form Submissions
-
+
Improve this doc
-
Grails has built-in support for handling duplicate form submissions using the "Synchronizer Token Pattern". To get started you define a token on the form tag:
+
Grails has built-in support for handling duplicate form submissions using the "Synchronizer Token Pattern". To get started you define a token on the form tag:
servletContext - Also known as application scope, this scope lets you share state across the entire web application. The servletContext is an instance of ServletContext
+
servletContext - Also known as application scope, this scope lets you share state across the entire web application. The servletContext is an instance of ServletContext
-
session - The session allows associating state with a given user and typically uses cookies to associate a session with a client. The session object is an instance of HttpSession
+
session - The session allows associating state with a given user and typically uses cookies to associate a session with a client. The session object is an instance of HttpSession
-
request - The request object allows the storage of objects for the current request only. The request object is an instance of HttpServletRequest
+
request - The request object allows the storage of objects for the current request only. The request object is an instance of HttpServletRequest
params - Mutable map of incoming request query string or POST parameters
@@ -179,7 +179,7 @@
Available Scopes
Accessing Scopes
-
Scopes can be accessed using the variable names above in combination with Groovy’s array index operator, even on classes provided by the Servlet API such as the HttpServletRequest:
+
Scopes can be accessed using the variable names above in combination with Groovy’s array index operator, even on classes provided by the Servlet API such as the HttpServletRequest:
allowedHeaders:
- Content-Typemappings:
- /api/**:
+ '[/api/**]':
allowedOrigins:
- http://localhost:5000# Other configurations not specified default to the global config
Instead of directly accessing Grails configuration as grailsApplication.config.mail.hostName, use a Spring Boot configuration bean (or a POJO) annotated with ConfigurationProperties annotation. Here is an example plugin configuration:
Plugins and applications that need to define template generation tasks can do so using scripts. A example of this is the Scaffolding plugin which defines the generate-all and generate-controllers commands.
-
Every Grails script implements the TemplateRenderer interface which makes it trivial to render templates to the users project workspace.
+
Every Grails script implements the TemplateRenderer interface which makes it trivial to render templates to the users project workspace.
The following is an example of the create-script command written in Groovy:
@@ -254,7 +254,7 @@
Template Generation
The "model"
-
Executing the model method with a Class/String/File/Resource will return an instance of Model. The model contains several properties that can help you generate code.
+
Executing the model method with a Class/String/File/Resource will return an instance of Model. The model contains several properties that can help you generate code.
Example:
@@ -278,7 +278,7 @@
The "model"
Working with files
-
All scripts have access to methods on the FileSystemInteraction class. It contains helpful methods to copy, delete, and create files.
+
All scripts have access to methods on the FileSystemInteraction class. It contains helpful methods to copy, delete, and create files.
The artefacts list can contain either handler classes (as above) or instances of handlers.
-
So, what does an artefact handler look like? Well, put simply it is an implementation of the ArtefactHandler interface. To make life a bit easier, there is a skeleton implementation that can readily be extended: ArtefactHandlerAdapter.
+
So, what does an artefact handler look like? Well, put simply it is an implementation of the ArtefactHandler interface. To make life a bit easier, there is a skeleton implementation that can readily be extended: ArtefactHandlerAdapter.
-
In addition to the handler itself, every new artefact needs a corresponding wrapper class that implements GrailsClass. Again, skeleton implementations are available such as AbstractInjectableGrailsClass, which is particularly useful as it turns your artefact into a Spring bean that is auto-wired, just like controllers and services.
+
In addition to the handler itself, every new artefact needs a corresponding wrapper class that implements GrailsClass. Again, skeleton implementations are available such as AbstractInjectableGrailsClass, which is particularly useful as it turns your artefact into a Spring bean that is auto-wired, just like controllers and services.
The best way to understand how both the handler and wrapper classes work is to look at the Quartz plugin:
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
+
The Application class can also be used as a source for Spring bean definitions, simply define a method annotated with the Bean and the returned object will become a Spring bean. The name of the method is used as the bean name:
Arbitrary strategies may be plugged in by providing a class which implements the UrlConverter interface and adding an instance of that class to the Spring application context with the bean name of grails.web.UrlConverter.BEAN_NAME. If Grails finds a bean in the context with that name, it will be used as the default converter and there is no need to assign a value to the grails.web.url.converter config property.
+
Arbitrary strategies may be plugged in by providing a class which implements the UrlConverter interface and adding an instance of that class to the Spring application context with the bean name of grails.web.UrlConverter.BEAN_NAME. If Grails finds a bean in the context with that name, it will be used as the default converter and there is no need to assign a value to the grails.web.url.converter config property.
The BindUsing annotation may be used to define a custom binding mechanism for a particular field in a class. Any time data binding is being applied to the field the closure value of the annotation will be invoked with 2 arguments. The first argument is the object that data binding is being applied to and the second argument is DataBindingSource which is the data source for the data binding. The value returned from the closure will be bound to the property. The following example would result in the upper case version of the name value in the source being applied to the name field during data binding.
+
The BindUsing annotation may be used to define a custom binding mechanism for a particular field in a class. Any time data binding is being applied to the field the closure value of the annotation will be invoked with 2 arguments. The first argument is the object that data binding is being applied to and the second argument is DataBindingSource which is the data source for the data binding. The value returned from the closure will be bound to the property. The following example would result in the upper case version of the name value in the source being applied to the name field during data binding.
@@ -751,7 +751,7 @@
The BindUsing Annotation
-
The BindUsing annotation may be used to define a custom binding mechanism for all of the fields on a particular class. When the annotation is applied to a class, the value assigned to the annotation should be a class which implements the BindingHelper interface. An instance of that class will be used any time a value is bound to a property in the class that this annotation has been applied to.
+
The BindUsing annotation may be used to define a custom binding mechanism for all of the fields on a particular class. When the annotation is applied to a class, the value assigned to the annotation should be a class which implements the BindingHelper interface. An instance of that class will be used any time a value is bound to a property in the class that this annotation has been applied to.
@@ -766,8 +766,8 @@
The BindUsing Annotation
The BindInitializer Annotation
-
The BindInitializer annotation may be used to initialize an associated field in a class if it is undefined.
-Unlike the BindUsing annotation, databinding will continue binding all nested properties on this association.
+
The BindInitializer annotation may be used to initialize an associated field in a class if it is undefined.
+Unlike the BindUsing annotation, databinding will continue binding all nested properties on this association.
@@ -805,7 +805,7 @@
The BindInitializer Annotation
Custom Data Converters
-
The binder will do a lot of type conversion automatically. Some applications may want to define their own mechanism for converting values and a simple way to do this is to write a class which implements ValueConverter and register an instance of that class as a bean in the Spring application context.
+
The binder will do a lot of type conversion automatically. Some applications may want to define their own mechanism for converting values and a simple way to do this is to write a class which implements ValueConverter and register an instance of that class as a bean in the Spring application context.
@@ -869,7 +869,7 @@
Custom Data Converters
Date Formats For Data Binding
-
A custom date format may be specified to be used when binding a String to a Date value by applying the BindingFormat annotation to a Date field.
+
A custom date format may be specified to be used when binding a String to a Date value by applying the BindingFormat annotation to a Date field.
@@ -916,7 +916,7 @@
Date Formats For Data Binding
Custom Formatted Converters
-
You may supply your own handler for the BindingFormat annotation by writing a class which implements the FormattedValueConverter interface and registering an instance of that class as a bean in the Spring application context. Below is an example of a trivial custom String formatter that might convert the case of a String based on the value assigned to the BindingFormat annotation.
+
You may supply your own handler for the BindingFormat annotation by writing a class which implements the FormattedValueConverter interface and registering an instance of that class as a bean in the Spring application context. Below is an example of a trivial custom String formatter that might convert the case of a String based on the value assigned to the BindingFormat annotation.
@@ -1033,7 +1033,7 @@
Structured Data Binding Editors
A Gadget has 2 Shape fields. A Shape has an area property. It may be that the application wants to accept request parameters like width and height and use those to calculate the area of a Shape at binding time. A structured binding editor is well suited for that.
The DataBindingListener interface provides a mechanism for listeners to be notified of data binding events. The interface looks like this:
+
The DataBindingListener interface provides a mechanism for listeners to be notified of data binding events. The interface looks like this:
@@ -1171,7 +1171,7 @@
Data Binding Event Listeners
-
Any bean in the Spring application context which implements that interface will automatically be registered with the data binder. The DataBindingListenerAdapter class implements the DataBindingListener interface and provides default implementations for all of the methods in the interface so this class is well suited for subclassing so your listener class only needs to provide implementations for the methods your listener is interested in.
+
Any bean in the Spring application context which implements that interface will automatically be registered with the data binder. The DataBindingListenerAdapter class implements the DataBindingListener interface and provides default implementations for all of the methods in the interface so this class is well suited for subclassing so your listener class only needs to provide implementations for the methods your listener is interested in.
@@ -1206,7 +1206,7 @@
Using The Data Binder Directly
-
An instance of the data binder is in the Spring application context with a bean name of grailsWebDataBinder. That bean implements the DataBinder interface. The following code demonstrates using the data binder directly.
+
An instance of the data binder is in the Spring application context with a bean name of grailsWebDataBinder. That bean implements the DataBinder interface. The following code demonstrates using the data binder directly.
grails-app/services/bindingdmeo/WidgetService
@@ -1228,7 +1228,7 @@
Using The Data Binder Directly
-
See the DataBinder documentation for more information about overloaded versions
+
See the DataBinder documentation for more information about overloaded versions
of the bind method.
The H2 database console is a convenient feature of H2 that provides a web-based interface to any database that you have a JDBC driver for, and it’s very useful to view the database you’re developing against. It’s especially useful when running against an in-memory database.
The BE1PC implementation was added in Grails 2.3.6. . Before this change additional datasources didn’t take part in transactions initiated in Grails. The transactions in additional datasources were basically in auto commit mode. In some cases this might be the wanted behavior. One reason might be performance: on the start of each new transaction, the BE1PC transaction manager creates a new transaction to each datasource. It’s possible to leave an additional datasource out of the BE1PC transaction manager by setting transactional = false in the respective configuration block of the additional dataSource. Datasources with readOnly = true will also be left out of the chained transaction manager (since 2.3.7).
-
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
+
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
You can exclude transaction manager beans from the BE1PC implementation with this configuration option:
@@ -858,14 +858,14 @@
XA and Two-phase Commit
When the Best Efforts 1PC pattern isn’t suitable for handling transactions across multiple transactional resources (not only datasources), there are several options available for adding XA/2PC support to Grails applications.
-
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
+
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
The H2 database console is a convenient feature of H2 that provides a web-based interface to any database that you have a JDBC driver for, and it’s very useful to view the database you’re developing against. It’s especially useful when running against an in-memory database.
The result is that all methods are wrapped in a transaction and automatic rollback occurs if a method throws an exception (both Checked or Runtime exceptions) or an Error. The propagation level of the transaction is by default set to PROPAGATION_REQUIRED.
+
The result is that all methods are wrapped in a transaction and automatic rollback occurs if a method throws an exception (both Checked or Runtime exceptions) or an Error. The propagation level of the transaction is by default set to PROPAGATION_REQUIRED.
@@ -335,7 +335,7 @@
Custom Transaction Configuration
Transaction status
-
An instance of TransactionStatus is available by default in Grails transactional service methods.
+
An instance of TransactionStatus is available by default in Grails transactional service methods.
By default interceptors will match the controllers with the same name. For example if you have an interceptor called BookInterceptor then all requests to the actions of the BookController will trigger the interceptor.
-
An Interceptor implements the Interceptor trait and provides 3 methods that can be used to intercept requests:
+
An Interceptor implements the Interceptor trait and provides 3 methods that can be used to intercept requests:
@@ -195,7 +195,7 @@
8.5.1 Defining Interceptors
-
The afterView method is executed after view rendering completes. If an exception occurs, the exception is available using the throwable property of the Interceptor trait.
+
The afterView method is executed after view rendering completes. If an exception occurs, the exception is available using the throwable property of the Interceptor trait.
+Grails 5 contains dependencies that requirejavax.el-api:3.0 (eg.: datastore-gorm:7.x, spring-boot:2.x) which is only supported starting from Tomcat 8.x+, based on the tomcat version table!
+
+
+
+
Unlike most scripts which default to the development environment unless overridden, the war command runs in the production environment by default. You can override this like any script by specifying the environment name, for example:
Before looking at providing runtime configuration based on conventions you first need to understand how to evaluate those conventions from a plugin. Every plugin has an implicit application variable which is an instance of the GrailsApplication interface.
+
Before looking at providing runtime configuration based on conventions you first need to understand how to evaluate those conventions from a plugin. Every plugin has an implicit application variable which is an instance of the GrailsApplication interface.
The GrailsApplication interface provides methods to evaluate the conventions within the project and internally stores references to all artifact classes within your application.
-
Artifacts implement the GrailsClass interface, which represents a Grails resource such as a controller or a tag library. For example to get all GrailsClass instances you can do:
+
Artifacts implement the GrailsClass interface, which represents a Grails resource such as a controller or a tag library. For example to get all GrailsClass instances you can do:
WebAttributes is one of the traits provided by the framework. Any Groovy class may implement this trait to inherit all of the properties and behaviors provided by the trait.
+
WebAttributes is one of the traits provided by the framework. Any Groovy class may implement this trait to inherit all of the properties and behaviors provided by the trait.
src/main/groovy/demo/Helper.groovy
diff --git a/snapshot/guide/pages/executing.html b/snapshot/guide/pages/executing.html
index fc9f54cba6a..0b095b366fc 100644
--- a/snapshot/guide/pages/executing.html
+++ b/snapshot/guide/pages/executing.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 4.2.1 Executing the Application Class 4.0.13
+ 4.2.1 Executing the Application Class 5.0.1
@@ -44,7 +44,7 @@
10.5.1 Extending the RestfulController super class
-
Version: 4.0.13
+
Version: 5.0.1
@@ -145,7 +145,7 @@
10.5.1 Extending the RestfulController super class
10.5.1 Extending the RestfulController super class
-
+
Improve this doc
@@ -286,7 +286,7 @@
Customizing D
-
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
+
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
Grails has built-in support for handling duplicate form submissions using the "Synchronizer Token Pattern". To get started you define a token on the form tag:
+
Grails has built-in support for handling duplicate form submissions using the "Synchronizer Token Pattern". To get started you define a token on the form tag:
The above command will create a new Spock spec called MyFunctionalSpec.groovy in the src/integration-test/groovy directory. The test is annotated with the Integration annotation to indicate it is an integration test and extends the GebSpec super class:
+
The above command will create a new Spock spec called MyFunctionalSpec.groovy in the src/integration-test/groovy directory. The test is annotated with the Integration annotation to indicate it is an integration test and extends the GebSpec super class:
@@ -196,7 +196,7 @@
15.3 Functional Testing
In addition the application is loaded in the JVM as the test, this means that the test has full access to the application state and can interact directly with data services such as GORM to setup and cleanup test data.
-
The Integration annotation supports an optional applicationClass attribute which may be used to specify the application class to use for the functional test. The class must extend GrailsAutoConfiguration.
+
The Integration annotation supports an optional applicationClass attribute which may be used to specify the application class to use for the functional test. The class must extend GrailsAutoConfiguration.
diff --git a/snapshot/guide/pages/furtherReading.html b/snapshot/guide/pages/furtherReading.html
index 459dda1bb5e..d2202d77fc6 100644
--- a/snapshot/guide/pages/furtherReading.html
+++ b/snapshot/guide/pages/furtherReading.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 7.2 Further Reading on GORM 4.0.13
+ 7.2 Further Reading on GORM 5.0.1
@@ -44,7 +44,7 @@
Grails 3.1 uses the Gradle Build System for build related tasks such as compilation, runnings tests and producing binary distributions of your project. It is recommended to use Gradle 2.2 or above with Grails 3.1.
+
Since Grails 3.1 the Gradle Build System is used for build related tasks such as compilation, runnings tests and producing binary distributions of your project. It is recommended to use Gradle 2.2 or above with Grails 3.1 (and higher).
The build is defined by the build.gradle file which specifies the version of your project, the dependencies of the project and the repositories where to find those dependencies (amongst other things).
@@ -181,7 +181,7 @@
5.5 Building with Gradle
-
You can invoke Gradle directly using the gradle command and use your own local version of Gradle, however you will need Gradle 2.2 or above to work with Grails 3.0:
+
You can invoke Gradle directly using the gradle command and use your own local version of Gradle, however you will need Gradle 2.2 or above to work with Grails 3.0 (and higher):
@@ -193,7 +193,7 @@
5.5 Building with Gradle
5.5.1 Defining Dependencies with Gradle
-
+
Improve this doc
@@ -222,7 +222,8 @@
5.5.1 Defining Dependencies with Gradle
runtime 'org.grails.plugins:asset-pipeline'
runtime 'org.grails.plugins:scaffolding'
- testCompile 'org.grails:grails-plugin-testing'
+ testCompile "org.grails:grails-gorm-testing-support"
+ testCompile "org.grails:grails-web-testing-support"
testCompile 'org.grails.plugins:geb'// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
@@ -250,7 +251,7 @@
The grails.compiler.GrailsTypeChecked annotation works a lot like the GrailsCompileStatic annotation except that it only enables static type checking, not static compilation. This affords compile time feedback for expressions which cannot be validated statically at compile time while still leaving dynamic dispatch in place for the class.
+
The grails.compiler.GrailsTypeChecked annotation works a lot like the GrailsCompileStatic annotation except that it only enables static type checking, not static compilation. This affords compile time feedback for expressions which cannot be validated statically at compile time while still leaving dynamic dispatch in place for the class.
First, you can hook in Grails runtime configuration overriding the doWithSpring method from the Plugin class and returning a closure that defines additional beans. For example the following snippet is from one of the core Grails plugins that provides i18n support:
+
First, you can hook in Grails runtime configuration overriding the doWithSpring method from the Plugin class and returning a closure that defines additional beans. For example the following snippet is from one of the core Grails plugins that provides i18n support:
@@ -260,7 +260,7 @@
Adding New Servlet Filters
Doing Post Initialisation Configuration
-
Sometimes it is useful to be able do some runtime configuration after the Spring ApplicationContext has been built. In this case you can define a doWithApplicationContext closure property.
+
Sometimes it is useful to be able do some runtime configuration after the Spring ApplicationContext has been built. In this case you can define a doWithApplicationContext closure property.
diff --git a/snapshot/guide/pages/hypermedia.html b/snapshot/guide/pages/hypermedia.html
index 6f98b4dfe21..4a50e42b4b9 100644
--- a/snapshot/guide/pages/hypermedia.html
+++ b/snapshot/guide/pages/hypermedia.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 10.12 Hypermedia as the Engine of Application State 4.0.13
+ 10.12 Hypermedia as the Engine of Application State 5.0.1
@@ -44,7 +44,7 @@
10.12 Hypermedia as the Engine of Application State
-
Version: 4.0.13
+
Version: 5.0.1
@@ -159,7 +159,7 @@
Table of Contents
10.12 Hypermedia as the Engine of Application State
-
+
Improve this doc
@@ -176,7 +176,7 @@
10.12 Hypermedia as the Engine of Application State
10.12.1 HAL Support
-
+
Improve this doc
@@ -572,7 +572,7 @@
Customizing Link Rendering
10.12.2 Atom Support
-
+
Improve this doc
@@ -622,7 +622,7 @@
10.12.2 Atom Support
10.12.3 Vnd.Error Support
-
+
Improve this doc
diff --git a/snapshot/guide/pages/ide.html b/snapshot/guide/pages/ide.html
index 8861acca85a..f5ff121cf29 100644
--- a/snapshot/guide/pages/ide.html
+++ b/snapshot/guide/pages/ide.html
@@ -11,7 +11,7 @@
gtag('config', 'UA-82213539-2');
- 2.6 Getting Set Up in an IDE 4.0.13
+ 2.6 Getting Set Up in an IDE 5.0.1
@@ -44,7 +44,7 @@
IntelliJ IDEA is an excellent IDE for Grails 4.0 development. It comes in 2 editions, the free community edition and the paid-for ultimate edition.
+
IntelliJ IDEA is an excellent IDE for Grails 5.0 development. It comes in 2 editions, the free community edition and the paid-for ultimate edition.
The community edition can be used for most things, although GSP syntax higlighting is only part of the ultimate edition
@@ -172,7 +172,7 @@
IntelliJ IDEA
-
To get started with Intellij IDEA and Grails 4.0 simply go to File / Open and point IDEA at your build.gradle file to import and configure the project.
+
To get started with Intellij IDEA and Grails 5.0 simply go to File / Open and point IDEA at your build.gradle file to import and configure the project.
Integration test methods run inside their own database transaction by default, which is rolled back at the end of each test method. This means that data saved during a test is not persisted to the database (which is shared across all tests). The default generated integration test template includes the Rollback annotation:
+
Integration test methods run inside their own database transaction by default, which is rolled back at the end of each test method. This means that data saved during a test is not persisted to the database (which is shared across all tests). The default generated integration test template includes the Rollback annotation:
@@ -219,7 +219,7 @@
Transactions
-
To automatically roll back setup logic, any persistence operations need to be called from the test method itself so that they are run within the test method’s rolled back transaction. Similar to usage of the setupData() method shown below:
+
To preload the database and automatically roll back setup logic, any persistence operations need to be called from the test method itself so that they can run within the test method’s rolled back transaction. Similar to usage of the setupData() method shown below which creates a record in database and after running other test will be rolled back:
@@ -250,7 +250,7 @@
Transactions
Using Spring’s Rollback annotation
-
Another transactional approach could be to use Spring’s @Rollback instead.
+
Another transactional approach could be to use Spring’s @Rollback instead.
@@ -290,13 +290,13 @@
Using Spring’s Rollback annota
DirtiesContext
-
If you do have a series of tests that will share state you can remove the Rollback and the last test in the suite should feature the DirtiesContext annotation which will shutdown the environment and restart it fresh (note that this will have an impact on test run times).
+
If you do have a series of tests that will share state you can remove the Rollback and the last test in the suite should feature the DirtiesContext annotation which will shutdown the environment and restart it fresh (note that this will have an impact on test run times).
Autowiring
-
To obtain a reference to a bean you can use the Autowired annotation. For example:
+
To obtain a reference to a bean you can use the Autowired annotation. For example:
As mention in the previous section, by default an interceptor will match only requests to the associated controller by convention. However you can configure the interceptor to match any request using the match or matchAll methods defined in the Interceptor API.
+
As mention in the previous section, by default an interceptor will match only requests to the associated controller by convention. However you can configure the interceptor to match any request using the match or matchAll methods defined in the Interceptor API.
-
The matching methods return a Matcher instance which can be used to configure how the interceptor matches the request.
+
The matching methods return a Matcher instance which can be used to configure how the interceptor matches the request.
For example the following interceptor will match all requests except those to the login controller:
@@ -205,7 +205,7 @@
8.5.2 Matching Requests with Interceptors
-
All named arguments except for uri accept either a String or a Regex expression. The uri argument supports a String path that is compatible with Spring’s AntPathMatcher. The possible named arguments are:
+
All named arguments except for uri accept either a String or a Regex expression. The uri argument supports a String path that is compatible with Spring’s AntPathMatcher. The possible named arguments are:
By default interceptors will match the controllers with the same name. For example if you have an interceptor called BookInterceptor then all requests to the actions of the BookController will trigger the interceptor.
-
An Interceptor implements the Interceptor trait and provides 3 methods that can be used to intercept requests:
+
An Interceptor implements the Interceptor trait and provides 3 methods that can be used to intercept requests:
@@ -255,24 +255,24 @@
8.5.1 Defining Interceptors
-
The afterView method is executed after view rendering completes. If an exception occurs, the exception is available using the throwable property of the Interceptor trait.
+
The afterView method is executed after view rendering completes. If an exception occurs, the exception is available using the throwable property of the Interceptor trait.
8.5.2 Matching Requests with Interceptors
-
+
Improve this doc
-
As mention in the previous section, by default an interceptor will match only requests to the associated controller by convention. However you can configure the interceptor to match any request using the match or matchAll methods defined in the Interceptor API.
+
As mention in the previous section, by default an interceptor will match only requests to the associated controller by convention. However you can configure the interceptor to match any request using the match or matchAll methods defined in the Interceptor API.
-
The matching methods return a Matcher instance which can be used to configure how the interceptor matches the request.
+
The matching methods return a Matcher instance which can be used to configure how the interceptor matches the request.
For example the following interceptor will match all requests except those to the login controller:
@@ -322,7 +322,7 @@
8.5.2 Matching Requests with Interceptors
-
All named arguments except for uri accept either a String or a Regex expression. The uri argument supports a String path that is compatible with Spring’s AntPathMatcher. The possible named arguments are:
+
All named arguments except for uri accept either a String or a Regex expression. The uri argument supports a String path that is compatible with Spring’s AntPathMatcher. The possible named arguments are:
The respond method will then look for an appriopriate Renderer for the object and the calculated media type from the RendererRegistry.
+
The respond method will then look for an appriopriate Renderer for the object and the calculated media type from the RendererRegistry.
Grails includes a number of pre-configured Renderer implementations that will produce default representations of JSON responses for the argument passed to respond. For example going to the /book.json URI will produce JSON such as:
The previous section on XML and JSON responses covered simplistic examples of rendering XML and JSON responses. Whilst the XML builder used by Grails is the standard XmlSlurper found in Groovy.
The BE1PC implementation was added in Grails 2.3.6. . Before this change additional datasources didn’t take part in transactions initiated in Grails. The transactions in additional datasources were basically in auto commit mode. In some cases this might be the wanted behavior. One reason might be performance: on the start of each new transaction, the BE1PC transaction manager creates a new transaction to each datasource. It’s possible to leave an additional datasource out of the BE1PC transaction manager by setting transactional = false in the respective configuration block of the additional dataSource. Datasources with readOnly = true will also be left out of the chained transaction manager (since 2.3.7).
-
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
+
By default, the BE1PC implementation will add all beans implementing the Spring PlatformTransactionManager interface to the chained BE1PC transaction manager. For example, a possible JMSTransactionManager bean in the Grails application context would be added to the Grails BE1PC transaction manager’s chain of transaction managers.
You can exclude transaction manager beans from the BE1PC implementation with this configuration option:
@@ -473,14 +473,14 @@
XA and Two-phase Commit
When the Best Efforts 1PC pattern isn’t suitable for handling transactions across multiple transactional resources (not only datasources), there are several options available for adding XA/2PC support to Grails applications.
-
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
+
The Spring transactions documentation contains information about integrating the JTA/XA transaction manager of different application servers. In this case, you can configure a bean with the name transactionManager manually in resources.groovy or resources.xml file.
mkdir - To make a directory specified by the location parameter
-
execute - To execute a command specified by the class parameter. Must be a class that implements the Command interface.
+
execute - To execute a command specified by the class parameter. Must be a class that implements the Command interface.
gradle - To execute one or many Gradle tasks specified by the tasks parameter.
@@ -208,7 +208,7 @@
6.5 Creating Profile Commands
-
If you need more flexiblity than what the declarative YAML approach provides you can create Groovy script commands. Each Command script is extends from the GroovyScriptCommand class and hence has all of the methods of that class available to it.
+
If you need more flexibility than what the declarative YAML approach provides you can create Groovy script commands. Each Command script is extends from the GroovyScriptCommand class and hence has all of the methods of that class available to it.
The following is an example of the create-script command written in Groovy:
To exclude transitive dependencies, define excludes key with a List of transitive dependencies Map of the dependency group, module, classifier, and extension as:
Grails supports the notion of property placeholder configuration through an extended version of Spring’s PropertyPlaceholderConfigurer.
+
Grails supports the notion of property placeholder configuration through an extended version of Spring’s PropertyPlaceholderConfigurer.
-
Settings defined in either ConfigSlurper scripts or Java properties files can be used as placeholder values for Spring configuration in grails-app/conf/spring/resources.xml and grails-app/conf/spring/resources.groovy. For example given the following entries in grails-app/conf/application.groovy (or an externalized config):
+
Settings defined in either ConfigSlurper scripts or Java properties files can be used as placeholder values for Spring configuration in grails-app/conf/spring/resources.xml and grails-app/conf/spring/resources.groovy. For example given the following entries in grails-app/conf/application.groovy (or an externalized config):
As a plugin developer, it can be important for you to find out about what domain classes, controllers, or other types of artefact are available in an application. For example, the Elasticsearch plugin needs to know what domain classes exist so it can check them for any searchable properties and index the appropriate ones. So how does it do it? The answer lies with the grailsApplication object, and instance of GrailsApplication that’s available automatically in controllers and GSPs and can be injected everywhere else.
+
As a plugin developer, it can be important for you to find out about what domain classes, controllers, or other types of artefact are available in an application. For example, the Elasticsearch plugin needs to know what domain classes exist so it can check them for any searchable properties and index the appropriate ones. So how does it do it? The answer lies with the grailsApplication object, and instance of GrailsApplication that’s available automatically in controllers and GSPs and can be injected everywhere else.
The grailsApplication object has several important properties and methods for querying artefacts. Probably the most common is the one that gives you all the classes of a particular artefact type:
@@ -213,7 +213,7 @@
18.10.1 Asking About Available Artefacts
-
You need to be aware that the objects returned by these properties are not instances of Class. Instead, they are instances of GrailsClass that has some particularly useful properties and methods, including one for the underlying Class:
+
You need to be aware that the objects returned by these properties are not instances of Class. Instead, they are instances of GrailsClass that has some particularly useful properties and methods, including one for the underlying Class:
Before installing Grails 4.0.13 you will need as a minimum a Java Development Kit (JDK) installed version 1.8 or above. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.
+
Before installing Grails 5.0.1 you will need as a minimum a Java Development Kit (JDK) installed version 1.8. The most recent supported version of the JDK is 11. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.
To automate the installation of Grails we recommend SDKMAN which greatly simplifies installing and managing multiple Grails versions.
-
On some platforms (for example OS X) the Java installation is automatically detected. However in many cases you will want to manually configure the location of Java. For example, if you’re using bash or another variant of the Bourne Shell:
+
On some platforms (for example macOS) the Java installation is automatically detected. However in many cases you will want to manually configure the location of Java. For example, if you’re using bash or another variant of the Bourne Shell:
10.5.1 Extending the RestfulController super class
-
+
Improve this doc
@@ -314,7 +314,7 @@
Customizing D
-
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
+
By default the getObjectToBind() method returns the request object. When the request object is used as the binding source, if the request has a body then the body will be parsed and its contents will be used to do the data binding, otherwise the request parameters will be used to do the data binding. Subclasses of RestfulController may override the getObjectToBind() method and return anything that is a valid binding source, including a Map or a DataBindingSource. For most use cases binding the request is appropriate but the getObjectToBind() method allows for changing that behavior where desired.
@@ -365,7 +365,7 @@
Us
10.5.2 Implementing REST Controllers Step by Step
-
+
Improve this doc
@@ -663,7 +663,7 @@
Implementing the 'delete' action
10.5.3 Generating a REST controller using scaffolding
Grails scaffolding templates for controllers and views are fully i18n-aware. The GSPs use the message tag for labels, buttons etc. and controller flash messages use i18n to resolve locale-specific messages.
+
Grails scaffolding templates for controllers and views are fully i18n-aware. The GSPs use the message tag for labels, buttons etc. and controller flash messages use i18n to resolve locale-specific messages.
The scaffolding includes locale specific labels for domain classes and domain fields. For example, if you have a Book domain class with a title field: