I've externalized my Grails configuration basically the same way as the config file suggests. I've done it all the time with my 1.3 projects and the line
grails.serverURL = "http://localhost:8080/${appName}"
in the external config worked great. Now I experience the problem with 2.0 that Grails seems not to be able to resolve the ${appName} - it will use [:] instead in redirects.
As soon as I move this line back to the internal configuration, everything works fine.
Is there any way to move this configuration line to the external configuration? Am I doing something wrong?
You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration. Property values can be injected directly into your beans using the @Value annotation, accessed via Spring's Environment abstraction or bound to structured objects.
This way, a configuration can be provided from different sources, for example, file systems, the internet, external services, configuration services, vaults, etc.
Spring Boot Framework comes with a built-in mechanism for application configuration using a file called application. properties. It is located inside the src/main/resources folder, as shown in the following figure.
You can use ${grails.util.Metadata.current.getApplicationName()}
instead.
Note that since Metadata
implements Map
you can't shorten that to ${grails.util.Metadata.current.applicationName}
since the key isn't applicationName
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With