Unable to load application.groovy while running bootRun target
Expected Behavior
We are seeing issue while starting the Grails App using bootRun, our Application do have lot of configuration specified in grails-app/conf/application.groovy one such configuration is grails.config.locations as shown below, the configuration files have App specific and DB configurations. During App startup we see issue loading application.groovy resulting in Application not coming up.
application.groovy
grails.config.locations = [
XYZ_DB_CONFIG: "XYZ_configuration.groovy",
XYZ_APP_CONFIG: "XYZApp_configuration.groovy"
]
Analysis:
After debugging the Grails codebase we do see issue in grails-core where the class GroovyConfigPropertySourceLoader.groovy responsible for loading the configurations is using deprecated class NavigableMap , in GroovyConfigPropertySourceLoader.load() method in this method we see the following happening
- groovy.util.ConfigObject is been constructed from ConfigSlurper using application.groovy wich has all the configurations specified in application.groovy
- Further NavigableMap.merge(configObject, false) seems to be not working i.e. we see empty NavigableMap as shown in the debug snapshot
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
Windows 11 Pro grails-7.0.0-M1 JDK 17
Example Application
No response
Version
grails-7.0.0-M1
Can you please provide a sample application that reproduces this?
We have tried to reproduce previous reports of configuration not working with this example: https://github.com/jdaugherty/grails7-example-configurationaware
All previous reports of this not working were due to referring to a class that no longer exists in Grails 7 due to the jakarta upgrade.
I had the same issue. The problem was that configs get filtered by spring.profiles.active. If the config contains a spring.profiles.active property and it doesn't match your active spring profiles, or if you don't have an active spring profile the config is discarded. I didn't have an active spring profile, so I added -Dspring.profiles.active=development to the bootRun jvmArgs. This solved the issue for me.
@weinellucian is this working in 7.0.0-RC1 or 7.0.0-SNAPSHOT?
Environment config was broken in earlier 7 versions due to the micronaut removal. This was likely the cause given the spring profile relation.