user
11/17/2025, 4:12 AMprecompiledGspMap was not being populated for groovyPageLocator bean, as fall back it tried to use resourceLoader to load the gsp and then render it. That's why it works in development mode(because it use resourceLoader anyway for development mode)
I have to do the following work around to put the code in resource.groovy to make the whole project working with grails 7.0.2.
// Force precompiledGspMap to be used in production
// Override the groovyPageLocator bean from GroovyPagesGrailsPlugin
// to force loading of precompiled GSPs even when Metadata thinks dev is available
if (Environment.current == Environment.PRODUCTION && !Environment.isDevelopmentMode()) {
groovyPageLocator(org.grails.web.gsp.io.CachingGrailsConventionGroovyPageLocator) { bean ->
bean.lazyInit = true
// Force loading of precompiled GSP map from gsp/views.properties in WEB-INF/classes
precompiledGspMap = { org.springframework.beans.factory.config.PropertiesFactoryBean pfb ->
ignoreResourceNotFound = true
location = 'classpath:gsp/views.properties'
}
reloadEnabled = false
cacheTimeout = -1 // Never expire cache
}
// Force messageSource to load from classpath in production
// Override to ensure i18n message bundles are loaded from WEB-INF/classes
messageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) {
basename = 'classpath:messages'
defaultEncoding = 'UTF-8'
fallbackToSystemLocale = false
useCodeAsDefaultMessage = false
cacheSeconds = -1 // Cache forever in production
}
}
After putting this at the bottom of the resource.groovy. Everything works. I still doing the testing. Question is why do I have to do this? What is wrong? Obviously with simpler projects generated by the grails forge, it works perfectly too.jdaugherty
11/19/2025, 7:22 PMuser
11/20/2025, 5:36 AMimplementation "org.apache.grails:grails-layout"
Thanksjdaugherty
11/20/2025, 9:56 AMjdaugherty
11/20/2025, 9:57 AM