Example usage for org.springframework.expression.spel.standard SpelCompiler SpelCompiler

List of usage examples for org.springframework.expression.spel.standard SpelCompiler SpelCompiler

Introduction

In this page you can find the example usage for org.springframework.expression.spel.standard SpelCompiler SpelCompiler.

Prototype

private SpelCompiler(@Nullable ClassLoader classloader) 

Source Link

Usage

From source file:org.springframework.expression.spel.standard.SpelCompiler.java

/**
 * Factory method for compiler instances. The returned SpelCompiler will
 * attach a class loader as the child of the given class loader and this
 * child will be used to load compiled expressions.
 * @param classLoader the ClassLoader to use as the basis for compilation
 * @return a corresponding SpelCompiler instance
 *///from  ww  w.jav  a  2 s. com
public static SpelCompiler getCompiler(@Nullable ClassLoader classLoader) {
    ClassLoader clToUse = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
    synchronized (compilers) {
        SpelCompiler compiler = compilers.get(clToUse);
        if (compiler == null) {
            compiler = new SpelCompiler(clToUse);
            compilers.put(clToUse, compiler);
        }
        return compiler;
    }
}