Skip to content

Commit

Permalink
Support for shared GroovyClassLoader in GroovyScriptFactory
Browse files Browse the repository at this point in the history
Closes gh-25177
  • Loading branch information
jhoeller committed Jun 6, 2020
1 parent 4b78903 commit 5cb950d
Showing 1 changed file with 9 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 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 @@ -158,7 +158,14 @@ public void setBeanFactory(BeanFactory beanFactory) {

@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.groovyClassLoader = buildGroovyClassLoader(classLoader);
if (classLoader instanceof GroovyClassLoader &&
(this.compilerConfiguration == null ||
((GroovyClassLoader) classLoader).hasCompatibleConfiguration(this.compilerConfiguration))) {
this.groovyClassLoader = (GroovyClassLoader) classLoader;
}
else {
this.groovyClassLoader = buildGroovyClassLoader(classLoader);
}
}

/**
Expand Down

0 comments on commit 5cb950d

Please sign in to comment.