Package org.springframework.expression.spel

# Class SpelParserConfiguration

java.lang.Object
org.springframework.expression.spel.SpelParserConfiguration

public class SpelParserConfiguration extends Object
Configuration object for the SpEL expression parser.

Since:
  3.0
Author:
  Juergen Hoeller, Phillip Webb, Andy Clement, Sam Brannen
See Also:
  - `SpelExpressionParser(SpelParserConfiguration)`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_MAX_EXPRESSION_LENGTH`
Default maximum length permitted for a SpEL expression: 10000.
`static final String`
`SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME`
System property to configure the default compiler mode for SpEL expression parsers: "spring.expression.compiler.mode".

## Constructor Summary

Constructors
Constructor
Description
`SpelParserConfiguration()`
Create a new `SpelParserConfiguration` instance with default settings.
`SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections)`
Create a new `SpelParserConfiguration` instance.
`SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize)`
Create a new `SpelParserConfiguration` instance.
`SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader)`
Create a new `SpelParserConfiguration` instance.
`SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize)`
Create a new `SpelParserConfiguration` instance.
`SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength)`
Create a new `SpelParserConfiguration` instance.

## Method Summary

Modifier and Type
Method
Description
`ClassLoader`
`getCompilerClassLoader()`
Return the ClassLoader to use as the basis for expression compilation.
`SpelCompilerMode`
`getCompilerMode()`
Return the compiler mode for parsers using this configuration object.
`int`
`getMaximumAutoGrowSize()`
Return the maximum size that a collection can auto grow.
`int`
`getMaximumExpressionLength()`
Return the maximum number of characters that a SpEL expression can contain.
`boolean`
`isAutoGrowCollections()`
Return `true` if collections should be automatically grown.
`boolean`
`isAutoGrowNullReferences()`
Return `true` if `null` references should be automatically grown.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_MAX_EXPRESSION_LENGTH

public static final int DEFAULT_MAX_EXPRESSION_LENGTH
Default maximum length permitted for a SpEL expression: 10000.

Since:
  5.2.24
See Also:
  - Constant Field Values

### SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME

public static final String SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME
System property to configure the default compiler mode for SpEL expression parsers: "spring.expression.compiler.mode".

See Also:
  - Constant Field Values

## Constructor Details

### SpelParserConfiguration

public SpelParserConfiguration()
Create a new `SpelParserConfiguration` instance with default settings.

### SpelParserConfiguration

public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader)
Create a new `SpelParserConfiguration` instance.

Parameters:
  `compilerMode` - the compiler mode for the parser
  `compilerClassLoader` - the ClassLoader to use as the basis for expression compilation

### SpelParserConfiguration

public SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections)
Create a new `SpelParserConfiguration` instance.

Parameters:
  `autoGrowNullReferences` - if null references should automatically grow
  `autoGrowCollections` - if collections should automatically grow
See Also:
  - `SpelParserConfiguration(boolean, boolean, int)`

### SpelParserConfiguration

public SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize)
Create a new `SpelParserConfiguration` instance.

Parameters:
  `autoGrowNullReferences` - if null references should automatically grow
  `autoGrowCollections` - if collections should automatically grow
  `maximumAutoGrowSize` - the maximum size that the collection can auto grow

### SpelParserConfiguration

public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize)
Create a new `SpelParserConfiguration` instance.

Parameters:
  `compilerMode` - the compiler mode that parsers using this configuration object should use
  `compilerClassLoader` - the ClassLoader to use as the basis for expression compilation
  `autoGrowNullReferences` - if null references should automatically grow
  `autoGrowCollections` - if collections should automatically grow
  `maximumAutoGrowSize` - the maximum size that the collection can auto grow

### SpelParserConfiguration

public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength)
Create a new `SpelParserConfiguration` instance.

Parameters:
  `compilerMode` - the compiler mode that parsers using this configuration object should use
  `compilerClassLoader` - the ClassLoader to use as the basis for expression compilation
  `autoGrowNullReferences` - if null references should automatically grow
  `autoGrowCollections` - if collections should automatically grow
  `maximumAutoGrowSize` - the maximum size that a collection can auto grow
  `maximumExpressionLength` - the maximum length of a SpEL expression; must be a positive number
Since:
  5.2.25

## Method Details

### getCompilerMode

public SpelCompilerMode getCompilerMode()
Return the compiler mode for parsers using this configuration object.

### getCompilerClassLoader

@Nullable public ClassLoader getCompilerClassLoader()
Return the ClassLoader to use as the basis for expression compilation.

### isAutoGrowNullReferences

public boolean isAutoGrowNullReferences()
Return `true` if `null` references should be automatically grown.

### isAutoGrowCollections

public boolean isAutoGrowCollections()
Return `true` if collections should be automatically grown.

### getMaximumAutoGrowSize

public int getMaximumAutoGrowSize()
Return the maximum size that a collection can auto grow.

### getMaximumExpressionLength

public int getMaximumExpressionLength()
Return the maximum number of characters that a SpEL expression can contain.

Since:
  5.2.25