Skip to content

Merge 9.0.x into 9.1.x - #17103

Merged
codeconsole merged 151 commits into
apache:9.1.xfrom
codeconsole:merge/9.0.x-into-9.1.x
Nov 20, 2026
Merged

codeconsole merged 151 commits into
apache:9.1.xfrom
codeconsole:merge/9.0.x-into-9.1.x

Conversation

@codeconsole

@codeconsole codeconsole commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Merges 9.0.x into 9.1.x, which brings #16992, #16996, #17018, #17084 and #17088, and two merges of 8.1.x, to this line.

No conflicts. The merge differs from 9.0.x only by 9.1.x's own version identity (projectVersion, githubBranch, the threat model's version binding and GrailsUtilTests).

#17104 (9.1.x into 10.0.x) is built on this branch, so merge this one first.

jamesfredley and others added 30 commits November 6, 2026 10:57
Spring's Environment does not return a nested map for dataSource.properties,
so YAML pool settings such as maximumPoolSize never reached HikariCP. Rebuild
that map from flattened keys when the direct lookup is empty, and leave an
existing map unchanged.

Fixes apache#16567

Assisted-by: Sisyphus:grok-4.7
The Hikari assertions no longer assume a fixed two-proxy chain.

Assisted-by: Sisyphus:grok-4.7
development, test, and production each apply their own pool settings.
An unset grails.env uses development. A key the active block does not
set stays at the root value.

Assisted-by: Sisyphus:grok-4.7
The map is now rebuilt from each property source in precedence order,
so the highest source wins for every path whatever its shape:

- A scalar or map from a higher source is not replaced by a lower
  nested key, map, or unresolved placeholder.
- A map stored at the exact path is read per source instead of being
  returned early, so higher flattened keys still win over it.
- Indexed keys such as connectionInitSqls[0] build a List, copying an
  existing list instead of mutating it.
- Literal dotted keys such as oracle.jdbc.flag are kept as written and
  block the same nested path from lower sources and from later entries
  of the same source.
- A string the conversion service turns into a map is used at its own
  precedence, after placeholder resolution.

String values still go through Environment.getProperty, so the
unresolvable-placeholder setting is kept.

ConfigurationBuilderSpec now covers the Environment path, including a
map-backed @builder(SimpleStrategy) type and an unchanged
DatastoreUtils resolver. The datasource specs cover a YAML list and the
dotted application.groovy form.

Assisted-by: Sisyphus:grok-4.7
Assisted-by: Sisyphus:claude-opus-5-5
A DatastoreEnvironment still merges prepared sources, so a key that
exists only on a lower map is kept. The walk skips the systemProperties
and systemEnvironment sources StandardEnvironment adds.

Assisted-by: sisyphus-cursor-grok:grok-4.7
A raw Spring Environment binds a configuration map from flattened names
only. A map stored at the exact path is used only when no flattened name
exists. DatastoreEnvironment still returns its prepared map and does not
walk JVM or lower configuration sources.

Assisted-by: Sisyphus:grok-4.7
A list built from name[n] kept accepting indexes from lower property
sources, so -DdataSource.properties.connectionInitSqls[0]='SET X=9'
over a three-item list in application.yml gave [SET X=9, SET B=2,
SET C=3]. A list stored as a value already replaced a lower list
whole, as Spring Boot does. A list now takes indexes only from the
source that built it, so both forms give [SET X=9].
…ndler

UrlMappingsHandlerMapping now sets HandlerMapping.BEST_MATCHING_HANDLER_ATTRIBUTE
to the UrlMappingInfo it returns, as Spring MVC's own handler mappings set it for
the handler they find, and takes it off the request once the dispatch completes,
with an interceptor first in the chain so that it completes last, whichever
interceptor stops the request. A dispatch another handler mapping handles in the
meantime, such as a forward to a Spring MVC endpoint, keeps the attribute it set.

Content negotiation can then tell a request a URL mapping handles from one a
Spring MVC endpoint handles, and from what Spring Security negotiates after the
dispatch. The version lookup no longer fails for a request whose response type
resolves to none.
…he#16698)

The opt-in grails.mime.negotiation.spring (default false in Grails 10) resolves
request.format, response.format, withFormat and the format respond writes in
with Spring MVC's ContentNegotiationManager, as the formats grails.mime.types
gives the media types it resolves:

- The Accept header is read by Spring MVC's manager, with its strategies and
  spring.mvc.contentnegotiation.*, in its order: quality, then specificity, then
  the order of the header. The text/xml merge and the +xml preference are gone.
- A type with the +json or +xml suffix that no configured type names is the json
  or xml format, as Spring MVC's converters write such types; this extends the
  rule Grails 9 had for the problem types of RFC 9457.
- */* is the all format, also where it is not configured. Another wildcard, such
  as text/*, is a type of the all format that withFormat answers with its first
  block, and respond with the first of the action's formats, whose format has a
  type compatible with it.
- A request that accepts no configured type, or whose Accept header Spring cannot
  read, has no format: response.format is null, respond answers 406 and withFormat
  runs its * block or none.
- The format parameter and URL extensions are kept, ahead of Spring MVC's
  strategies; an unknown format is not acceptable and all leaves the format to
  the Accept header. request.format reads Content-Type with Spring's parser.

The format parameter, URL extensions and the grails.mime Accept header settings
are installed into Spring MVC's manager, by a post-processor that replaces the
mvcContentNegotiationManager bean with the setting only, as strategies that apply
while a URL mapping handles the request, so that what Spring MVC writes for an
action, such as a ResponseEntity or a ProblemDetail, is negotiated as Grails
resolves its format. Spring MVC endpoints and Spring Security, before a mapping
has matched the request, negotiate as before, and GrailsContentNegotiationStrategy
is still no Spring ContentNegotiationStrategy bean. A web unit test marks the
request of the action it calls as handled by a URL mapping, as in an application.

Without the setting, every answer is that of Grails 9.
…type

ReflectionUtils.matchAllUrlMappings read the version of the response type, which
grails.mime.negotiation.spring resolves to none for a request that accepts no
configured type, such as one that sends only Accept: image/png, so every such
request failed in the security filter with a NullPointerException. It now matches
any version, as for a type without one.
FormatNegotiationComparisonSpec runs a matrix of requests a URL mapping handles
through both policies, with and without grails.mime.negotiation.spring, under
several grails.mime.types and Accept header configurations: Accept headers with
qualities, wildcards and +json/+xml types, browser and XHR user agents, the format
parameter, and Content-Type. It records each answer that differs, from
response.format, withFormat, request.format and the media types Spring MVC's
manager resolves for what it writes, so that a change to either policy that
changes an answer fails it, and checks that with the setting the first type the
manager resolves is of the format Grails resolves.
app1 answers the same requests with and without grails.mime.negotiation.spring:
a ResponseEntity an action returns is written in the format of its URL
extension, or not acceptable where no converter writes it so, an unknown format
is not acceptable, the formats Grails resolves follow Spring MVC's order, a +json
body is of the json format, and a Spring MVC endpoint keeps its negotiation.
The content negotiation guide describes how the setting resolves formats with
Spring MVC's manager and what becomes of each Grails rule: kept, extended or
dropped. The new Upgrading from Grails 9 to Grails 10 section lists the answers
that change, which FormatNegotiationComparisonSpec records, and the built-in
properties list the setting.
The setting is opt-in in Grails 9, and Grails 10 makes it the default, as it does
for the other migration settings in grails.config.Settings: the new API is
@SInCE 9.0, the upgrade notes are section 22 of Upgrading from Grails 8 to Grails
9, which the content negotiation guide and What's New point to, and the settings
documentation gives its default as false in Grails 9 and true from Grails 10.
A forward an action makes is a dispatch of its own, which Spring MVC's handler
mappings match after the URL mappings, while the mapping of the forwarding
dispatch was still the request's best matching handler. With
grails.mime.negotiation.spring, the produces condition of an endpoint was then
matched on the format the action was asked for: /book/forward?format=xml to an
endpoint that produces JSON answered 406 for a client that accepts JSON. The URL
mappings now take a mapping an earlier dispatch left off the request when they
match no handler for the dispatch.
The post-processor that replaces Spring MVC's content negotiation manager read
the setting from the Spring Environment, while the strategy that resolves Grails
formats read it from the application's configuration. A configuration that is not
the environment, as one a test builds by hand or one code changes, could then
enable one half of the setting without the other: Grails formats resolved with
Spring MVC's manager while what Spring MVC writes ignored the Grails rules, or the
other way round. Both now read the application's configuration.
The functional spec with grails.mime.negotiation.spring ran in app1 with
@TestPropertySource, which starts a second application context in the test JVM.
GORM's static API then answered for that context, so the GORM specs of app1 that
ran after it failed with "No Session found for current thread". The spec moves to
grails-test-examples/spring-format-negotiation, whose application.yml sets the
setting, with the Spring MVC endpoint and the actions it calls; app1 keeps the
spec of the Grails rules, which runs in its own context.
With grails.mime.negotiation.spring and a grails.mime.types that does not list
all, a client that accepts any type resolves to the all format, which reading
response.format saves as the response format. respond then resolved that saved
format to no type, and answered 406: the all format is now */*, any type, as
Spring MVC reads it, whether or not grails.mime.types lists it. ?format=all then
leaves the format to the Accept header there too, for Grails formats and for what
Spring MVC writes.
grails.mime.negotiation.spring took the types of the Accept header in Spring
MVC's order alone, so Accept: application/xml, application/atom+xml resolved to
xml where the Grails rules resolve it to atom. A type with the +xml suffix of the
quality of the first application/xml or text/xml now comes ahead of it, each one
later in the header in front of those before it, as the Grails rules order them,
for Grails formats and, for a request a URL mapping handles, for what Spring MVC
writes. The comparison record loses the atom answers, and the guide and upgrade
notes list the rule as kept; they also describe the all format of the previous
commit.
…otiation

With spring.mvc.contentnegotiation.favor-parameter, Spring MVC's parameter
negotiation reads the format parameter, as Grails does. Grails left the all
format to the Accept header, and the parameter strategy then read the same
parameter again and found all not acceptable: ?format=all with Accept:
application/json answered 406 to respond and to what Spring MVC writes for the
action. For a request a URL mapping handles, Grails now reads the format
parameter in place of that strategy, so all is left to the Accept header; a
Spring MVC endpoint still reads it with Spring MVC's parameter negotiation.
The interactive Forge CLI took its Tab completion from picocli-shell-jline3,
which is built for JLine 3. CommandLineCompleter makes the same picocli
AutoComplete call against the JLine API directly, so the prompt completes
as before and no longer depends on a bridge tied to one JLine major.
jline.version tracks the JLine that groovysh is built on, but stayed at
3.30.16 when 9.0.x moved to Groovy 6, whose groovysh uses JLine 4.4.5.
grails-console leaves groovysh's own JLine modules off the class path in
favour of the org.jline:jline bundle, so grails shell ran groovysh 6 on
JLine 3 and failed to start with ClassNotFoundException:
org.jline.shell.CommandGroup, a class only JLine 4 has.

The BOM now manages JLine 4.4.5. The SBOM license table drops its JLine 3
entries, which the JLine 4 correction in forcedLicenseFor replaces, and the
upgrade guide describes the move.
@CommandArgument and @commandoption describe the positional arguments
and the options of an ApplicationCommand, so a command line tool can show
them in the command's help, check them and complete them. They only
describe the command, which still reads its command line as before.

ApplicationCommandManifestWriter writes every command the registry finds
on the classpath, with its description, arguments and options, to a JSON
file that tools read without loading the commands themselves.

The writer reads the annotations with getAnnotation rather than
getAnnotationsByType: the static compiler links getAnnotationsByType with
an Object[] return type the JDK method does not have, so the call fails
with NoSuchMethodError.
The task writes the commands runCommand can run to
build/grails/commands.json, running the grails-core-cli writer on
runCommand's classpath without starting the application. It stays up to
date while that classpath is unchanged.
Inside a Grails project, the Forge CLI offers the commands of the
application and of its plugins next to its own, with their help and
their completion at the prompt, and runs them through the project's
runCommand task.

It reads them from the manifest generateCommandManifest writes, and runs
that task first when the manifest is missing or older than the build
files or grails-app/commands. The Forge CLI's own commands never wait for
the build, and keep their names over a project command of the same name.
Declared arguments and options are checked and completed; a command that
declares none takes any and passes them on.
s2-quickstart declares its four optional class name arguments and its
groupClassName, uiOnly and salt options, and the s2-create-* commands
the domain class name they need, so the Forge CLI checks and completes
them. The s2-create-* commands also get a description of their own
instead of their name.
The Forge CLI section explains which commands of a project it offers,
how it learns them from generateCommandManifest and when it runs that
task. Creating Custom Commands shows @CommandArgument and @commandoption,
and What's New introduces the feature.
…asked for

The Gradle wrapper was looked for in every directory above the project,
so a gradlew in a shared parent directory, outside the project's build,
would have been run, and without a wrapper gradle on the path was. Only
the project's own wrapper or the one at the root of its build, the first
directory above it with a settings file, runs now; a build without one
offers no project commands.

--help and the other options no longer run the build either. They list
the project's commands from the manifest the build last wrote, and the
build runs only for the interactive prompt or when a command the Forge
CLI does not have is named.
The in-memory datastore of unit tests builds a datastore for each other
connection, and for each tenant with a database or a schema of its own,
but registered no event listeners for them. Their sessions publish their
events with that datastore as the source, which only its own listeners
handle, so a save through one, such as book.secondary.save(), ran no
domain class events and set no timestamps. Each now registers its own.
MultiTenant.withTenant(tenantId) and withTenant(tenantId) { } looked up
the class's API through findStaticApi, which resolves the current tenant
first. With a database or a schema per tenant and no current tenant, that
threw TenantNotFoundException although the call names the tenant. They
now start from the class's own API, as eachTenant already did.
The datasources example takes SessionHolder from Grails' copy of Spring's
Hibernate 5 support, since 8.0.x has no org.springframework.orm.hibernate5.
… an include, and close them when a request goes asynchronous

The Hibernate 7 GrailsOpenSessionInViewInterceptor gets what b2fad4e,
97d88c2, fd34e16 and 0dcd946 give the Hibernate 5 one:

- A request that finds a session of another datasource already bound, as an
  include does, uses it and leaves it to the call that opened it.
- When a request goes asynchronous, the sessions it opened for the other
  datasources are unbound and closed. Each is flushed first when postHandle
  would flush it and Hibernate allows the flush, and released whatever that
  flush throws.
- When Grails made the request asynchronous, for a promise or startAsync(),
  the default session it opened is closed too.

MultiDataSourceSessionSpec and the Hibernate 7 datasources example get the
tests that the Hibernate 5 plugin and the datasources example got.
Where 8.0.x's update to Spring Boot 4.1.3 conflicts, in dependencies.gradle
and VulnerabilityScanPlugin, 9.0.x keeps its Spring Boot 4.2.0 versions and
notes.
The form field tags handed a RequestDataValueProcessor the value in a new
GString. The new String lost the encoder's record that the value was
already encoded, so the processor's result was encoded again even when the
processor returned it unchanged. A value encoded with encodeAsHTML() before
it reached g:checkBox, g:actionSubmit or g:actionSubmitImage was therefore
written encoded twice once these tags encoded their values, and the same
already happened in g:textField, g:hiddenField and the other field tags.
g:radio encoded every value twice with a processor.

A String is now handed to the processor as it is, and g:select hands on an
option value that is a String as it is, so these values are written
encoded once when the processor returns them unchanged. The processor's
result is still encoded, so a value that the processor changes is encoded
after the change.
…Column

g:paginate added currentStep, prevLink, step or nextLink to the class it
was given, and g:sortableColumn added sortable and the sort order. Both
encoded the joined class, so a class the caller had already encoded was
encoded twice. They now encode each class on its own, which leaves a class
the caller encoded as it is, and mark the joined class as encoded, so that
g:link and the attribute loop of g:sortableColumn do not encode it again.
Undertow restores the dispatcher type once an include or a forward to a
named servlet returns, but not once a forward to a path does, so the
request went on reading as a forward. A filter that ran before the
forward read it as one too once its chain had returned: Spring Framework
7.1's ServerHttpObservationFilter took an asynchronous dispatch that had
forwarded, as one to an error controller does, for a plain dispatch,
stopped its observation there as well as when the asynchronous processing
completed, and reported the failure twice.

An inner handler chain wrapper now puts back the dispatcher type of the
dispatch a forward returns to, as Tomcat and Jetty do.
Spring Framework 7.1.0 reads the failure of an asynchronous request off
the request once the processing completes, as it does at the end of any
other, and offers ServerHttpObservationFilter.recordHandledException for
a failure a framework handled. Grails still told the observation itself
whenever the filter had not read the failure at the end of an
asynchronous dispatch, so the handlers of the observation, one of which
marks the span, heard of it twice.

The resolvers now hand the failure to the filter, which reports it once
the exchange completes. The first failure of a request is the one it
reports: what fails after it, such as asynchronous processing the action
started timing out, or an error handler finding the response already
used, does not replace it. When Tomcat reports the failure an error
controller left on a request that started asynchronous processing, it
is taken off the request before the filter would read it again.

This replaces the reading of the filter's private observation attribute
and the decision, made once a dispatch returned, of whether the filter
would read the failure itself.
Moves the build from Gradle 9.9.1 to 9.9.2, the patch release that fixes
four advisories published on 2026-11-19:

- GHSA-4mf6-7pm2-6wm8 (high): SFTP repositories do not verify host keys
- GHSA-7f7r-77ff-fr6f (high): transitive snapshot dependencies skip
  dependency verification
- GHSA-99wf-vhq9-wm2x (high): TestKit uses a predictable directory in the
  system temporary directory
- GHSA-35pj-rg5r-8rpv (high): the daemon registry is briefly readable by
  other local users when it is created

It also fixes slow configuration cache serialization of GenerateModuleMetadata
and GenerateMavenPom with fromResolutionResult(), a slow missing-dependency
check for producers in included builds (a regression since 9.8.0), and plugin
resolution failing since 9.9.0 when the repository answers the plugin marker
jar request with 401.

The 9.9.2 wrapper jar is byte-identical to 9.9.1's and matches Gradle's
published gradle-9.9.2-wrapper.jar.sha256, so every wrapper jar, Forge's
bundled one included, is unchanged. Every location the 9.9.1 bump touched
moves to 9.9.2: the wrappers, build-logic, the grails-profiles skeletons, the
shell CLI's gradle-sample fixture, Forge's gradleWrapperProperties template,
gradleToolingApiVersion, .sdkmanrc, the gradle-developer skill and the version
the grails-upgrade skill names.

The Grails 7 fixture in end-to-end stays on Gradle 8.14.7, which is what
7.0.x still pins.

Release notes: https://docs.gradle.org/9.9.2/release-notes.html
An error controller that failed as well had its own failure resolved
inside the forward to it, and that failure was recorded on the
observation first, so the one the action threw, recorded once the
forward returned, did not replace it. The failure is now claimed before
the error handler runs and recorded once it has answered, over a
failure Spring MVC recorded as a handled server error meanwhile.
apache#17091 moves 7.0.x to Gradle 8.14.8, the 8.x patch release with the same
four security fixes as 9.9.2, so the end-to-end fixture that stands in for a
Grails 7 plugin moves with it.
…processor

Handing a String to a RequestDataValueProcessor as it is kept the record
that it was encoded, but also a raw mark: a value from message(), which
comes back marked raw, was written as the processor returned it, where a
new String had dropped the mark and the result was encoded. A value
captured from a GSP body, or returned by a tag such as fieldValue(), was
still handed on as a new String and encoded twice.

The processor now always gets a new String. When the value was recorded
as HTML-encoded, as opposed to marked raw, and the processor returns it
unchanged, the result is recorded as encoded again, so it is written once.
Any other result is encoded. A GString with a single value can return
that value from toString(), so the copy is made with a StringBuilder.

g:radio encodes a value marked raw again, as it did before, instead of
leaving it to encodeAsHTML(), which skips it. g:select hands its option
value on through the same path. g:checkBox no longer fails when its name
is not a String and a processor is registered. g:form and
g:formActionSubmit write a url attribute that was encoded beforehand once,
when the tag writes it as it was given.
g:sortableColumn wrote its title attribute as given, as the text of the
column's link. It now encodes it with the HTML encoder, which leaves a
title that was already encoded, or marked raw, as it is. A text resolved
from titleKey is written as the message source returns it; when the
message source has none, the title or the key is encoded.
…corded as handled

When the container had already reported the failure an error handler answered, as Tomcat does
for one left on a request that started asynchronous processing, a server error Spring MVC
recorded as handled after it, such as the 503 of the processing timing out or of an error
controller that fails, was read when the processing completed and became the error of the
observation. That later record is now taken back, so the observation keeps the first failure
and its handlers hear of it once.
…t dispatch sent is answered

A request dispatch that started asynchronous processing and then sent an error, as Spring MVC
does for a server error it resolves, left that processing open forever on Undertow. Undertow
sends the error, through the error page that maps to it, once the dispatch has returned, and
ends the exchange with it. The processing then never completed and never timed out, so its
listeners were never told: the observation of the request never stopped, and a DeferredResult
was never resolved. A handler now completes the processing once the exchange has ended, as
Tomcat and Jetty do.
…-encoding-7.0.x

The upgrade note on GSP tag attributes moves to the Grails 7.0.18 section, which public 7.0.x added.
The Grails 7.0.18 part of the skill lists the tags that now HTML-encode the attribute values they write, what an application checks, and the g:radio, field tag, g:select, g:paginate and g:sortableColumn values that are no longer encoded twice, as the upgrade guide does.
…n-reported-twice-9.0.x

9.0 (fix): Report a failure an error handler answered once on Spring Framework 7.1
…egotiation-9.0.x

9.0: Resolve Grails formats through Spring MVC's content negotiation
@codeconsole
codeconsole merged commit 0823922 into apache:9.1.x Nov 20, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants