Skip to content

Commit

Permalink
Merge pull request #367 from codeconsole/enableReload
Browse files Browse the repository at this point in the history
Race condition: GroovyPagesTemplateRenderer.afterPropertiesSet() is c…
  • Loading branch information
puneetbehl authored Aug 25, 2023
2 parents cfcda70 + 3c8a687 commit 7def2c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
}

// Setup the main templateEngine used to render GSPs
groovyPagesTemplateEngine(GroovyPagesTemplateEngine) { bean ->
groovyPagesTemplateEngine(GroovyPagesTemplateEngine) {
classLoader = ref("classLoader")
groovyPageLocator = groovyPageLocator
if (enableReload) {
Expand All @@ -221,6 +221,9 @@ class GroovyPagesGrailsPlugin extends Plugin {

groovyPagesTemplateRenderer(GroovyPagesTemplateRenderer) { bean ->
bean.autowire = true
if (enableReload) {
reloadEnabled = enableReload
}
}

// Setup the GroovyPagesUriService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ public void afterPropertiesSet() throws Exception {
generateViewMethod = ReflectionUtils.findMethod(scaffoldingTemplateGenerator.getClass(), "generateView", new Class<?>[] {
GrailsDomainClass.class, String.class, Writer.class});
}
reloadEnabled = groovyPagesTemplateEngine.isReloadEnabled();
}

/**
* Sets whether reloading is enabled
*
* @param reloadEnabled True if it is enabled
*/
public void setReloadEnabled(boolean reloadEnabled) {
this.reloadEnabled = reloadEnabled;
}

public void clearCache() {
Expand Down

0 comments on commit 7def2c7

Please sign in to comment.