Skip to content
Merged
Show file tree
Hide file tree
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
40 changes: 40 additions & 0 deletions grails-doc/src/en/guide/upgrading/upgrading60x.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -869,3 +869,43 @@ The legacy `org.grails.web.converters.marshaller.json.EnumMarshaller` and `org.g
==== 13. Upgrading the Spring Security Plugin

If your application uses the Grails Spring Security plugin, please consult the https://apache.github.io/grails-spring-security/snapshot/guide/index.html#upgrading-from-previous-versions[Upgrading from Previous Versions] section of the Spring Security plugin documentation for specific upgrade instructions related to Grails 7.

==== 14. Changes in CLI- and Forge-generated configuration files

From Grails 7.0.11 onwards, the CLIs (`grails-shell-cli` and `grails-forge-cli`) and the https://start.grails.org[Grails Forge website] no longer include several previously generated properties in `application.yml`.

Most of the removed entries simply restated framework defaults, so omitting them reduces clutter without changing behavior. However, `grails.urlmapping.cache.maxsize` is a special case: older generated applications explicitly set it to `1000`, while the framework default is now `5000`. If you want to preserve the older generated cache size, keep that property in your application.

If the application you are upgrading relies on a custom value for any of the following properties, or if you want to preserve the previous generated value of `grails.urlmapping.cache.maxsize`, keep that setting in your `application.yml` file.

These are the properties that were removed from generated `application.yml` files:

[source,yml]
.application.yml
----
grails:
controllers:
defaultScope: singleton # already framework default
converters:
encoding: UTF-8 # already framework default
mime:
disable:
accept:
header:
userAgents: # already framework default
- Gecko
- WebKit
- Presto
- Trident
urlmapping:
cache:
maxsize: 1000 # Attention! framework default: 5000
views:
default:
codec: html # redundant because GSP expressions already default to html encoding
gsp:
codecs:
expression: html # already framework default
taglib: none # already framework default
staticparts: none # already framework default
----
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public void processSelectedFeatures(FeatureContext featureContext) {
@Override
public void apply(GeneratorContext generatorContext) {
final Map<String, Object> config = generatorContext.getConfiguration();
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
config.put("grails.mime.types.all", "*/*");
config.put("grails.mime.types.atom", "application/atom+xml");
config.put("grails.mime.types.css", "text/css");
Expand All @@ -96,10 +95,7 @@ public void apply(GeneratorContext generatorContext) {
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));
config.put("grails.views.gsp.encoding", "UTF-8");
config.put("grails.views.gsp.htmlcodec", "xml");
config.put("grails.views.gsp.codecs.expression", "html");
config.put("grails.views.gsp.codecs.scriptlet", "html");
config.put("grails.views.gsp.codecs.taglib", "none");
config.put("grails.views.gsp.codecs.staticparts", "none");
generatorContext.addDependency(Dependency.builder()
.groupId("org.apache.grails")
.artifactId("grails-gsp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public String getDescription() {
@Override
public void apply(GeneratorContext generatorContext) {
final Map<String, Object> config = generatorContext.getConfiguration();
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
config.put("grails.mime.types.json", Arrays.asList("application/json", "text/json"));
config.put("grails.mime.types.hal", Arrays.asList("application/hal+json", "application/hal+xml"));
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public String getDescription() {
@Override
public void apply(GeneratorContext generatorContext) {
final Map<String, Object> config = generatorContext.getConfiguration();
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));
config.put("grails.mime.types.atom", "application/atom+xml");
config.put("grails.mime.types.json", Arrays.asList("application/json", "text/json"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@

import jakarta.inject.Singleton;
import org.grails.forge.application.ApplicationType;
import org.grails.forge.application.generator.GeneratorContext;
import org.grails.forge.feature.DefaultFeature;
import org.grails.forge.feature.Feature;
import org.grails.forge.options.Options;

import java.util.Map;
import java.util.Set;

@Singleton
Expand All @@ -51,9 +49,4 @@ public boolean supports(ApplicationType applicationType) {
return applicationType != ApplicationType.PLUGIN;
}

@Override
public void apply(GeneratorContext generatorContext) {
final Map<String, Object> config = generatorContext.getConfiguration();
config.put("grails.views.default.codec", "html");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ class GrailsGspSpec extends ApplicationContextSpec implements CommandOutputFixtu
then:
ctx.getConfiguration().containsKey("grails.views.gsp.encoding")
ctx.getConfiguration().containsKey("grails.views.gsp.htmlcodec")
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.expression")
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.scriptlet")
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.taglib")
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.staticparts")
}

void "test mime configuration"() {
when:
final GeneratorContext ctx = buildGeneratorContext(["grails-gsp"])

then:
ctx.getConfiguration().get("grails.mime.disable.accept.header.userAgents") == Arrays.asList("Gecko", "WebKit", "Presto", "Trident")
ctx.getConfiguration().get("grails.mime.types.all") == "*/*"
ctx.getConfiguration().get("grails.mime.types.atom") == "application/atom+xml"
ctx.getConfiguration().get("grails.mime.types.css") == "text/css"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class ViewJsonSpec extends ApplicationContextSpec implements CommandOutputFixtur
final GeneratorContext ctx = buildGeneratorContext(["views-json"], new Options(null), ApplicationType.REST_API)

then:
ctx.getConfiguration().get("grails.mime.disable.accept.header.userAgents") == Arrays.asList("Gecko", "WebKit", "Presto", "Trident")
ctx.getConfiguration().get("grails.mime.types.json") == Arrays.asList("application/json", "text/json")
ctx.getConfiguration().get("grails.mime.types.hal") == Arrays.asList("application/hal+json", "application/hal+xml")
ctx.getConfiguration().get("grails.mime.types.xml") == Arrays.asList("text/xml", "application/xml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@

package org.grails.forge.feature.web

import groovy.yaml.YamlSlurper
import org.grails.forge.ApplicationContextSpec
import org.grails.forge.application.ApplicationType
import org.grails.forge.fixture.CommandOutputFixture
import org.grails.forge.options.DevelopmentReloading
import org.grails.forge.options.JdkVersion
import org.grails.forge.options.Options
import org.grails.forge.options.TestFramework

class GrailsWebSpec extends ApplicationContextSpec implements CommandOutputFixture{

Expand All @@ -39,13 +36,4 @@ class GrailsWebSpec extends ApplicationContextSpec implements CommandOutputFixtu
buildGradle.contains("apply plugin: \"org.apache.grails.gradle.grails-web\"")
}

void "test grails-web configuration"() {
when:
final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
final String applicationYaml = output["grails-app/conf/application.yml"]
def config = new YamlSlurper().parseText(applicationYaml)

then:
config.grails.views.default.codec == 'html'
}
}
43 changes: 4 additions & 39 deletions grails-profiles/base/skeleton/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,9 @@
grails:
profile: @grails.profile@
codegen:
defaultPackage: @grails.codegen.defaultPackage@
gorm:
reactor:
# Whether to translate GORM events into Reactor events
# Disabled by default for performance reasons
events: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
jmx:
unique-names: true
main:
banner-mode: "off"
groovy:
template:
check-template-location: false
devtools:
restart:
additional-exclude:
- '*.gsp'
- '**/*.gsp'
- '*.gson'
- '**/*.gson'
- 'logback-spring.xml'
- '*.properties'
environments:
development:
management:
endpoints:
enabled-by-default: true
web:
base-path: '/actuator'
exposure:
include: '*'
production:
management:
endpoints:
enabled-by-default: false
grails:
codegen:
defaultPackage: @grails.codegen.defaultPackage@
profile: @grails.profile@
15 changes: 0 additions & 15 deletions grails-profiles/rest-api/skeleton/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
json:
- application/json
Expand All @@ -25,10 +17,3 @@ grails:
rss: application/rss+xml
text: text/plain
all: '*/*'
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
20 changes: 0 additions & 20 deletions grails-profiles/web/skeleton/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
Expand All @@ -31,21 +23,9 @@ grails:
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlet: html
taglib: none
staticparts: none
26 changes: 1 addition & 25 deletions grails-test-examples/app1/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ info:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
groovy:
template:
check-template-location: false

---
grails11951:
Expand All @@ -47,14 +43,6 @@ reactor:
backlog: 1024
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
Expand All @@ -77,27 +65,15 @@ grails:
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
hibernate:
cache:
queries: false
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none
scriptlet: html
cors:
enabled: true
mappings:
Expand Down
25 changes: 0 additions & 25 deletions grails-test-examples/app2/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,9 @@ info:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
groovy:
template:
check-template-location: false

---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
Expand All @@ -61,27 +48,15 @@ grails:
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
hibernate:
cache:
queries: false
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none

---
dataSource:
Expand Down
Loading
Loading