Skip to content

Commit

Permalink
Merge pull request #154 from davidkron/issue-53
Browse files Browse the repository at this point in the history
Grails 5.0.0.M2: GroovyPageLayoutFinder is not properly inititialized during BootStrap (issue #53)
  • Loading branch information
puneetbehl authored Nov 24, 2021
2 parents 8215263 + 4cfefe8 commit cf13c36
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;

Expand All @@ -51,14 +52,16 @@
* @author Graeme Rocher
* @since 2.0
*/
public class GroovyPageLayoutFinder implements ApplicationListener<ContextRefreshedEvent>{
public class GroovyPageLayoutFinder implements ApplicationListener<ContextRefreshedEvent>, Ordered {
public static final String LAYOUT_ATTRIBUTE = "org.grails.layout.name";
public static final String NONE_LAYOUT = "_none_";
public static final String RENDERING_VIEW_ATTRIBUTE = "org.grails.rendering.view";
private static final Logger LOG = LoggerFactory.getLogger(GrailsLayoutDecoratorMapper.class);
private static final long LAYOUT_CACHE_EXPIRATION_MILLIS = Long.getLong("grails.gsp.reload.interval", 5000);
private static final String LAYOUTS_PATH = "/layouts";

private static final int ORDER = Ordered.LOWEST_PRECEDENCE - 1;

private Map<String, DecoratorCacheValue> decoratorCache = new ConcurrentHashMap<String, DecoratorCacheValue>();
private Map<LayoutCacheKey, DecoratorCacheValue> layoutDecoratorCache = new ConcurrentHashMap<LayoutCacheKey, DecoratorCacheValue>();

Expand All @@ -68,6 +71,11 @@ public class GroovyPageLayoutFinder implements ApplicationListener<ContextRefres
private ViewResolver viewResolver;
private boolean enableNonGspViews = false;

@Override
public int getOrder() {
return ORDER;
}

public void setDefaultDecoratorName(String defaultDecoratorName) {
this.defaultDecoratorName = defaultDecoratorName;
}
Expand Down

0 comments on commit cf13c36

Please sign in to comment.