Skip to content

Commit 5efadac

Browse files
authored
Merge pull request #15574 from apache/align-cli-conf-output
Cleanup and align `application.yml` in generated applications
2 parents 31555d7 + fa1d357 commit 5efadac

59 files changed

Lines changed: 102 additions & 1322 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

grails-doc/src/en/guide/upgrading/upgrading60x.adoc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,3 +869,43 @@ The legacy `org.grails.web.converters.marshaller.json.EnumMarshaller` and `org.g
869869
==== 13. Upgrading the Spring Security Plugin
870870

871871
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.
872+
873+
==== 14. Changes in CLI- and Forge-generated configuration files
874+
875+
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`.
876+
877+
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.
878+
879+
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.
880+
881+
These are the properties that were removed from generated `application.yml` files:
882+
883+
[source,yml]
884+
.application.yml
885+
----
886+
grails:
887+
controllers:
888+
defaultScope: singleton # already framework default
889+
converters:
890+
encoding: UTF-8 # already framework default
891+
mime:
892+
disable:
893+
accept:
894+
header:
895+
userAgents: # already framework default
896+
- Gecko
897+
- WebKit
898+
- Presto
899+
- Trident
900+
urlmapping:
901+
cache:
902+
maxsize: 1000 # Attention! framework default: 5000
903+
views:
904+
default:
905+
codec: html # redundant because GSP expressions already default to html encoding
906+
gsp:
907+
codecs:
908+
expression: html # already framework default
909+
taglib: none # already framework default
910+
staticparts: none # already framework default
911+
----

grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/view/GrailsGsp.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public void processSelectedFeatures(FeatureContext featureContext) {
8989
@Override
9090
public void apply(GeneratorContext generatorContext) {
9191
final Map<String, Object> config = generatorContext.getConfiguration();
92-
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
9392
config.put("grails.mime.types.all", "*/*");
9493
config.put("grails.mime.types.atom", "application/atom+xml");
9594
config.put("grails.mime.types.css", "text/css");
@@ -106,10 +105,7 @@ public void apply(GeneratorContext generatorContext) {
106105
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));
107106
config.put("grails.views.gsp.encoding", "UTF-8");
108107
config.put("grails.views.gsp.htmlcodec", "xml");
109-
config.put("grails.views.gsp.codecs.expression", "html");
110108
config.put("grails.views.gsp.codecs.scriptlet", "html");
111-
config.put("grails.views.gsp.codecs.taglib", "none");
112-
config.put("grails.views.gsp.codecs.staticparts", "none");
113109
generatorContext.addDependency(Dependency.builder()
114110
.groupId("org.apache.grails")
115111
.artifactId("grails-gsp")

grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/view/json/ViewJson.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public String getDescription() {
6363
@Override
6464
public void apply(GeneratorContext generatorContext) {
6565
final Map<String, Object> config = generatorContext.getConfiguration();
66-
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
6766
config.put("grails.mime.types.json", Arrays.asList("application/json", "text/json"));
6867
config.put("grails.mime.types.hal", Arrays.asList("application/hal+json", "application/hal+xml"));
6968
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));

grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/view/markup/ViewMarkup.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public String getDescription() {
5959
@Override
6060
public void apply(GeneratorContext generatorContext) {
6161
final Map<String, Object> config = generatorContext.getConfiguration();
62-
config.put("grails.mime.disable.accept.header.userAgents", Arrays.asList("Gecko", "WebKit", "Presto", "Trident"));
6362
config.put("grails.mime.types.xml", Arrays.asList("text/xml", "application/xml"));
6463
config.put("grails.mime.types.atom", "application/atom+xml");
6564
config.put("grails.mime.types.json", Arrays.asList("application/json", "text/json"));

grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/web/GrailsWeb.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020

2121
import jakarta.inject.Singleton;
2222
import org.grails.forge.application.ApplicationType;
23-
import org.grails.forge.application.generator.GeneratorContext;
2423
import org.grails.forge.feature.DefaultFeature;
2524
import org.grails.forge.feature.Feature;
2625
import org.grails.forge.options.Options;
2726

28-
import java.util.Map;
2927
import java.util.Set;
3028

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

54-
@Override
55-
public void apply(GeneratorContext generatorContext) {
56-
final Map<String, Object> config = generatorContext.getConfiguration();
57-
config.put("grails.views.default.codec", "html");
58-
}
5952
}

grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/GrailsGspSpec.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,14 @@ class GrailsGspSpec extends ApplicationContextSpec implements CommandOutputFixtu
6060
then:
6161
ctx.getConfiguration().containsKey("grails.views.gsp.encoding")
6262
ctx.getConfiguration().containsKey("grails.views.gsp.htmlcodec")
63-
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.expression")
6463
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.scriptlet")
65-
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.taglib")
66-
ctx.getConfiguration().containsKey("grails.views.gsp.codecs.staticparts")
6764
}
6865

6966
void "test mime configuration"() {
7067
when:
7168
final GeneratorContext ctx = buildGeneratorContext(["gsp"])
7269

7370
then:
74-
ctx.getConfiguration().get("grails.mime.disable.accept.header.userAgents") == Arrays.asList("Gecko", "WebKit", "Presto", "Trident")
7571
ctx.getConfiguration().get("grails.mime.types.all") == "*/*"
7672
ctx.getConfiguration().get("grails.mime.types.atom") == "application/atom+xml"
7773
ctx.getConfiguration().get("grails.mime.types.css") == "text/css"

grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/json/ViewJsonSpec.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class ViewJsonSpec extends ApplicationContextSpec implements CommandOutputFixtur
106106
final GeneratorContext ctx = buildGeneratorContext(["views-json"], new Options(null), ApplicationType.REST_API)
107107

108108
then:
109-
ctx.getConfiguration().get("grails.mime.disable.accept.header.userAgents") == Arrays.asList("Gecko", "WebKit", "Presto", "Trident")
110109
ctx.getConfiguration().get("grails.mime.types.json") == Arrays.asList("application/json", "text/json")
111110
ctx.getConfiguration().get("grails.mime.types.hal") == Arrays.asList("application/hal+json", "application/hal+xml")
112111
ctx.getConfiguration().get("grails.mime.types.xml") == Arrays.asList("text/xml", "application/xml")

grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/web/GrailsWebSpec.groovy

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919

2020
package org.grails.forge.feature.web
2121

22-
import groovy.yaml.YamlSlurper
2322
import org.grails.forge.ApplicationContextSpec
2423
import org.grails.forge.application.ApplicationType
2524
import org.grails.forge.fixture.CommandOutputFixture
2625
import org.grails.forge.options.DevelopmentReloading
27-
import org.grails.forge.options.JdkVersion
2826
import org.grails.forge.options.Options
29-
import org.grails.forge.options.TestFramework
3027

3128
class GrailsWebSpec extends ApplicationContextSpec implements CommandOutputFixture{
3229

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

42-
void "test grails-web configuration"() {
43-
when:
44-
final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
45-
final String applicationYaml = output["grails-app/conf/application.yml"]
46-
def config = new YamlSlurper().parseText(applicationYaml)
47-
48-
then:
49-
config.grails.views.default.codec == 'html'
50-
}
5139
}
Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,9 @@
1-
grails:
2-
profile: @grails.profile@
3-
codegen:
4-
defaultPackage: @grails.codegen.defaultPackage@
5-
gorm:
6-
reactor:
7-
# Whether to translate GORM events into Reactor events
8-
# Disabled by default for performance reasons
9-
events: false
101
info:
112
app:
123
name: '@info.app.name@'
134
version: '@info.app.version@'
145
grailsVersion: '@info.app.grailsVersion@'
15-
spring:
16-
jmx:
17-
unique-names: true
18-
main:
19-
banner-mode: "off"
20-
groovy:
21-
template:
22-
check-template-location: false
23-
devtools:
24-
restart:
25-
additional-exclude:
26-
- '*.gsp'
27-
- '**/*.gsp'
28-
- '*.gson'
29-
- '**/*.gson'
30-
- 'logback-spring.xml'
31-
- '*.properties'
32-
environments:
33-
development:
34-
management:
35-
endpoints:
36-
enabled-by-default: true
37-
web:
38-
base-path: '/actuator'
39-
exposure:
40-
include: '*'
41-
production:
42-
management:
43-
endpoints:
44-
enabled-by-default: false
6+
grails:
7+
codegen:
8+
defaultPackage: @grails.codegen.defaultPackage@
9+
profile: @grails.profile@
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
grails:
22
mime:
3-
disable:
4-
accept:
5-
header:
6-
userAgents:
7-
- Gecko
8-
- WebKit
9-
- Presto
10-
- Trident
113
types:
124
json:
135
- application/json
@@ -25,10 +17,3 @@ grails:
2517
rss: application/rss+xml
2618
text: text/plain
2719
all: '*/*'
28-
urlmapping:
29-
cache:
30-
maxsize: 1000
31-
controllers:
32-
defaultScope: singleton
33-
converters:
34-
encoding: UTF-8

0 commit comments

Comments
 (0)