Class SpelParserConfiguration
- Since:
- 3.0
- Author:
- Juergen Hoeller, Phillip Webb, Andy Clement, Sam Brannen
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum length permitted for a SpEL expression: 10000.static final intDefault maximum number of operations permitted during SpEL expression evaluation: 10000.static final StringSystem property to configure the default compiler mode for SpEL expression parsers: "spring.expression.compiler.mode".static final StringSystem property to configure the default maximum number of operations permitted during SpEL expression evaluation: "spring.expression.maxOperations". -
Constructor Summary
ConstructorsConstructorDescriptionCreate a newSpelParserConfigurationinstance with default settings.SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections) Create a newSpelParserConfigurationinstance.SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize) Create a newSpelParserConfigurationinstance.SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader) Create a newSpelParserConfigurationinstance.SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize) Create a newSpelParserConfigurationinstance.SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength) Create a newSpelParserConfigurationinstance.SpelParserConfiguration(SpelCompilerMode compilerMode, ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength, int maximumOperations) Create a newSpelParserConfigurationinstance. -
Method Summary
Modifier and TypeMethodDescriptionReturn theClassLoaderto use as the basis for expression compilation.Return the compiler mode for parsers using this configuration object.intReturn the maximum size to which a collection can auto grow.intReturn the maximum number of characters that a SpEL expression can contain.intReturn the maximum number of operations permitted during SpEL expression evaluation.booleanReturntrueif collections should be automatically grown.booleanReturntrueifnullreferences should be automatically grown.
-
Field Details
-
DEFAULT_MAX_EXPRESSION_LENGTH
public static final int DEFAULT_MAX_EXPRESSION_LENGTHDefault maximum length permitted for a SpEL expression: 10000.- Since:
- 5.2.24
- See Also:
-
DEFAULT_MAX_OPERATIONS
public static final int DEFAULT_MAX_OPERATIONSDefault maximum number of operations permitted during SpEL expression evaluation: 10000.- Since:
- 6.2.19
- See Also:
-
SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME
System property to configure the default compiler mode for SpEL expression parsers: "spring.expression.compiler.mode".NOTE: Instead of relying on a global default, applications and frameworks should ideally set an explicit custom value via the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor which provides complete configuration control and the ability to override global defaults per use case.Can also be configured via the
SpringPropertiesmechanism.- See Also:
-
SPRING_EXPRESSION_MAX_OPERATIONS_PROPERTY_NAME
System property to configure the default maximum number of operations permitted during SpEL expression evaluation: "spring.expression.maxOperations".NOTE: Instead of relying on a global default, applications and frameworks should ideally set an explicit custom value via the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor which provides complete configuration control and the ability to override global defaults per use case.Can also be configured via the
SpringPropertiesmechanism.- Since:
- 6.2.19
- See Also:
-
-
Constructor Details
-
SpelParserConfiguration
public SpelParserConfiguration()Create a newSpelParserConfigurationinstance with default settings.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case. -
SpelParserConfiguration
public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader) Create a newSpelParserConfigurationinstance.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case.- Parameters:
compilerMode- the compiler mode that parsers using this configuration should use; ornullto use the default modecompilerClassLoader- theClassLoaderto use as the basis for expression compilation; ornullto use the defaultClassLoader- See Also:
-
SpelParserConfiguration
public SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections) Create a newSpelParserConfigurationinstance.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case.- Parameters:
autoGrowNullReferences- if null references should automatically growautoGrowCollections- if collections should automatically grow- See Also:
-
SpelParserConfiguration
public SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize) Create a newSpelParserConfigurationinstance.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case.- Parameters:
autoGrowNullReferences- if null references should automatically growautoGrowCollections- if collections should automatically growmaximumAutoGrowSize- the maximum size to which a collection can auto grow- See Also:
-
SpelParserConfiguration
public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize) Create a newSpelParserConfigurationinstance.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case.- Parameters:
compilerMode- the compiler mode that parsers using this configuration should use; ornullto use the default modecompilerClassLoader- theClassLoaderto use as the basis for expression compilation; ornullto use the defaultClassLoaderautoGrowNullReferences- if null references should automatically growautoGrowCollections- if collections should automatically growmaximumAutoGrowSize- the maximum size to which a collection can auto grow- See Also:
-
SpelParserConfiguration
public SpelParserConfiguration(@Nullable SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength) Create a newSpelParserConfigurationinstance.NOTE: Favor the
SpelParserConfiguration(SpelCompilerMode, ClassLoader, boolean, boolean, int, int, int)constructor for complete configuration control and the ability to override global defaults per use case.- Parameters:
compilerMode- the compiler mode that parsers using this configuration should use; ornullto use the default modecompilerClassLoader- theClassLoaderto use as the basis for expression compilation; ornullto use the defaultClassLoaderautoGrowNullReferences- if null references should automatically growautoGrowCollections- if collections should automatically growmaximumAutoGrowSize- the maximum size to which a collection can auto growmaximumExpressionLength- the maximum length of a SpEL expression; must be a positive number- Since:
- 5.2.25
- See Also:
-
SpelParserConfiguration
public SpelParserConfiguration(SpelCompilerMode compilerMode, @Nullable ClassLoader compilerClassLoader, boolean autoGrowNullReferences, boolean autoGrowCollections, int maximumAutoGrowSize, int maximumExpressionLength, int maximumOperations) Create a newSpelParserConfigurationinstance.- Parameters:
compilerMode- the compiler mode that parsers using this configuration should use; must not benullcompilerClassLoader- theClassLoaderto use as the basis for expression compilation; ornullto use the defaultClassLoaderautoGrowNullReferences- if null references should automatically growautoGrowCollections- if collections should automatically growmaximumAutoGrowSize- the maximum size to which a collection can auto growmaximumExpressionLength- the maximum length of a SpEL expression; must be a positive numbermaximumOperations- the maximum number of operations permitted during SpEL expression evaluation; must be a positive number- Since:
- 6.2.19
-
-
Method Details
-
getCompilerMode
Return the compiler mode for parsers using this configuration object. -
getCompilerClassLoader
Return theClassLoaderto use as the basis for expression compilation. -
isAutoGrowNullReferences
public boolean isAutoGrowNullReferences()Returntrueifnullreferences should be automatically grown. -
isAutoGrowCollections
public boolean isAutoGrowCollections()Returntrueif collections should be automatically grown. -
getMaximumAutoGrowSize
public int getMaximumAutoGrowSize()Return the maximum size to which 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
-
getMaximumOperations
public int getMaximumOperations()Return the maximum number of operations permitted during SpEL expression evaluation.- Since:
- 6.2.19
-