Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Change wrong info about controller default scope #885

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/en/ref/Controllers/scope.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ class BookController {
=== Description


Unless specified by the `grails.controllers.defaultScope` property in `application.yml`, controllers by default are "singleton" scoped which means that only one instance of the controller exists.
This behaviour can be set for an individual controller by specifying a `scope` attribute with one of the following values:
Unless specified by the `grails.controllers.defaultScope` property in `application.yml`, controllers are by default "prototype"-scoped which means that a new controller will be created for each request.
The scope can be set for an individual controller by specifying a static `scope` attribute with one of the following values:

* `singleton` (default) - Only one instance of the controller ever exists (recommended for actions as methods)
* `prototype` - A new controller will be created for each request (recommended for actions as Closure properties)
* `prototype` (default) - A new controller will be created for each request (recommended for actions as Closure properties)
* `session` - One controller is created for the scope of a user session
* `singleton` - Only one instance of the controller ever exists (recommended for actions as methods)

NOTE: Newly created applications have the `grails.controllers.defaultScope` config property set to a value of "singleton" in `application.yml`.

See link:{guidePath}/theWebLayer.html#controllersAndScopes[Controllers and Scopes] in the user guide for more information.
Loading