Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Grails issue #12460 #257

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ public void setJspTagLibraryResolver(TagLibraryResolver jspTagLibraryResolver) {
this.jspTagLibraryResolver = jspTagLibraryResolver;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any specific reason to remove the setter?

Copy link

@darxriggs darxriggs Apr 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The discussion started here in spring-framework and this answer should shed some light on this.

* Sets the ClassLoader that the TemplateEngine should use to
* @param classLoader The ClassLoader to use when compilation of Groovy Pages occurs
*/
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}

/**
* Retrieves a line number matrix for the specified page that can be used
* to retrieve the actual line number within the GSP page if the line number within the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class GroovyPagesGrailsPlugin extends Plugin {

// Setup the main templateEngine used to render GSPs
groovyPagesTemplateEngine(GroovyPagesTemplateEngine) { bean ->
classLoader = ref("classLoader")
bean.lazyInit = true
Copy link
Contributor

@puneetbehl puneetbehl Apr 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change of lazyInit related to the issue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. gspTagLibraryLookup is very time consuming, it is lazy, so I add too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my test, the lazy-init doesn't have a noticeable effect, I can remove it currently.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a method to optimize gspTagLibraryLookup, this will greatly reduce initialization time.

groovyPageLocator = groovyPageLocator
if (enableReload) {
reloadEnabled = enableReload
Expand Down