Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Merge branch 'optimize_tag_library_lookup' into 5.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jun 6, 2022
2 parents d4a0e9c + cba67a3 commit a087ffd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2005 the original author or authors.
* Copyright 2004-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -48,10 +48,12 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean
import org.springframework.core.io.Resource
import org.springframework.util.ClassUtils
import org.springframework.web.servlet.view.InternalResourceViewResolver

/**
* Sets up and configures the GSP and GSP tag library support in Grails.
*
* @author Graeme Rocher
* @author Michael Yan
* @since 1.1
*/
@Slf4j
Expand Down Expand Up @@ -129,9 +131,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
}

// resolves GSP tag libraries
gspTagLibraryLookup(TagLibraryLookup) { bean ->
bean.lazyInit = true
}
gspTagLibraryLookup(TagLibraryLookup)


boolean customResourceLoader = false
Expand Down Expand Up @@ -202,7 +202,6 @@ class GroovyPagesGrailsPlugin extends Plugin {

// Setup the main templateEngine used to render GSPs
groovyPagesTemplateEngine(GroovyPagesTemplateEngine) { bean ->
bean.lazyInit = true
groovyPageLocator = groovyPageLocator
if (enableReload) {
reloadEnabled = enableReload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.grails.taglib.encoder.WithCodecHelper;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

Expand All @@ -36,19 +37,23 @@
* @author Graeme Rocher
* @since 1.1
*/
public class TagLibraryLookup implements ApplicationContextAware, GrailsApplicationAware, InitializingBean {
public class TagLibraryLookup implements ApplicationContextAware, GrailsApplicationAware, InitializingBean, SmartInitializingSingleton {
protected ApplicationContext applicationContext;
protected GrailsApplication grailsApplication;
protected Map<String, Map<String, Object>> tagNamespaces = new HashMap<>();
protected Map<String, NamespacedTagDispatcher> namespaceDispatchers = new HashMap<>();
protected Map<String, Set<String>> tagsThatReturnObjectForNamespace = new HashMap<String, Set<String>>();
protected Map<String, Map<String,Map<String, Object>>> encodeAsForTagNamespaces = new HashMap<String, Map<String,Map<String, Object>>>();

@Override
public void afterPropertiesSet() throws Exception {
if (grailsApplication == null || applicationContext == null) {
return;
}
}

@Override
public void afterSingletonsInstantiated() {
try {
registerTagLibraries();
} catch (GrailsConfigurationException e) {
Expand Down

0 comments on commit a087ffd

Please sign in to comment.