Skip to content

Commit

Permalink
Support for shared GroovyClassLoader in GroovyScriptFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller authored and zx20110729 committed Feb 18, 2022
1 parent 3a1356f commit cca1d86
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 cca1d86

Please sign in to comment.