org.springframework.expression.spel.SpelParserConfiguration Java Examples

The following examples show how to use org.springframework.expression.spel.SpelParserConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TerminationHandler.java    From styx with Apache License 2.0 5 votes vote down vote up
public TerminationHandler(RetryUtil retryUtil, Supplier<Map<WorkflowId, Workflow>> workflows) {
  this.retryUtil = Objects.requireNonNull(retryUtil, "retryUtil");
  this.workflows = Objects.requireNonNull(workflows, "workflows");

  var config = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, this.getClass().getClassLoader());
  expressionParser = new SpelExpressionParser(config);
  retryConditionExpressionCache = CacheBuilder.newBuilder()
      .maximumSize(RETRY_CONDITION_EXPRESSION_CACHE_SIZE)
      .build();
}
 
Example #2
Source File: Bucket4JAutoConfigurationWebfluxFilter.java    From bucket4j-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Bean
public ExpressionParser webFilterExpressionParser() {
	SpelParserConfiguration config = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE,
			this.getClass().getClassLoader());
	ExpressionParser parser = new SpelExpressionParser(config);

	return parser;
}
 
Example #3
Source File: Bucket4JAutoConfigurationServletFilter.java    From bucket4j-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Bean
public ExpressionParser servletFilterExpressionParser() {
	SpelParserConfiguration config = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, this.getClass().getClassLoader());
	ExpressionParser parser = new SpelExpressionParser(config);
	
	return parser;
}
 
Example #4
Source File: EclairAutoConfiguration.java    From eclair with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ExpressionEvaluator expressionEvaluator() {
    ExpressionParser expressionParser = new SpelExpressionParser(new SpelParserConfiguration(SpelCompilerMode.MIXED, null));
    StandardEvaluationContext evaluationContext = new StandardEvaluationContext();
    evaluationContext.setBeanResolver(new BeanFactoryResolver(applicationContext));
    return new ExpressionEvaluator(expressionParser, evaluationContext);
}
 
Example #5
Source File: Bucket4JAutoConfigurationZuul.java    From bucket4j-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
@Bean
public ExpressionParser zuulExpressionParser() {
	SpelParserConfiguration config = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE,
			this.getClass().getClassLoader());
	ExpressionParser parser = new SpelExpressionParser(config);
	return parser;
}
 
Example #6
Source File: SpelParser.java    From tutorials with MIT License 4 votes vote down vote up
public static void main(String[] args) {
    Car car = new Car();
    car.setMake("Good manufacturer");
    car.setModel("Model 3");
    car.setYearOfProduction(2014);

    CarPark carPark = new CarPark();

    SpelParserConfiguration config = new SpelParserConfiguration(true, true);

    StandardEvaluationContext context = new StandardEvaluationContext(carPark);

    ExpressionParser expressionParser = new SpelExpressionParser(config);
    expressionParser.parseExpression("cars[0]").setValue(context, car);

    Car result = carPark.getCars().get(0);

    System.out.println(result);
}
 
Example #7
Source File: SpelExpression.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Construct an expression, only used by the parser.
 */
public SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration) {
	this.expression = expression;
	this.ast = ast;
	this.configuration = configuration;
}
 
Example #8
Source File: SpelExpressionParser.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a parser with the specified configuration.
 * @param configuration custom configuration options
 */
public SpelExpressionParser(SpelParserConfiguration configuration) {
	Assert.notNull(configuration, "SpelParserConfiguration must not be null");
	this.configuration = configuration;
}
 
Example #9
Source File: SpelExpressionParser.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a parser with default settings.
 */
public SpelExpressionParser() {
	this.configuration = new SpelParserConfiguration();
}
 
Example #10
Source File: SpelExpression.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct an expression, only used by the parser.
 */
public SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration) {
	this.expression = expression;
	this.ast = ast;
	this.configuration = configuration;
}
 
Example #11
Source File: SpelExpressionParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a parser with the specified configuration.
 * @param configuration custom configuration options
 */
public SpelExpressionParser(SpelParserConfiguration configuration) {
	Assert.notNull(configuration, "SpelParserConfiguration must not be null");
	this.configuration = configuration;
}
 
Example #12
Source File: SpelExpressionParser.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a parser with default settings.
 */
public SpelExpressionParser() {
	this.configuration = new SpelParserConfiguration();
}
 
Example #13
Source File: SpelExpression.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Construct an expression, only used by the parser.
 */
public SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration) {
	this.expression = expression;
	this.ast = ast;
	this.configuration = configuration;
}
 
Example #14
Source File: SpelExpressionParser.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Create a parser with the specified configuration.
 * @param configuration custom configuration options
 */
public SpelExpressionParser(SpelParserConfiguration configuration) {
	Assert.notNull(configuration, "SpelParserConfiguration must not be null");
	this.configuration = configuration;
}
 
Example #15
Source File: SpelExpressionParser.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Create a parser with default settings.
 */
public SpelExpressionParser() {
	this.configuration = new SpelParserConfiguration();
}
 
Example #16
Source File: SpelExpression.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Construct an expression, only used by the parser.
 */
public SpelExpression(String expression, SpelNodeImpl ast, SpelParserConfiguration configuration) {
	this.expression = expression;
	this.ast = ast;
	this.configuration = configuration;
}
 
Example #17
Source File: SpelExpressionParser.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a parser with the specified configuration.
 * @param configuration custom configuration options
 */
public SpelExpressionParser(SpelParserConfiguration configuration) {
	Assert.notNull(configuration, "SpelParserConfiguration must not be null");
	this.configuration = configuration;
}
 
Example #18
Source File: SpelExpressionParser.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a parser with default settings.
 */
public SpelExpressionParser() {
	this.configuration = new SpelParserConfiguration();
}
 
Example #19
Source File: StandardBeanExpressionResolver.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a new {@code StandardBeanExpressionResolver} with the given bean class loader,
 * using it as the basis for expression compilation.
 * @param beanClassLoader the factory's bean class loader
 */
public StandardBeanExpressionResolver(ClassLoader beanClassLoader) {
	this.expressionParser = new SpelExpressionParser(new SpelParserConfiguration(null, beanClassLoader));
}
 
Example #20
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a parser with some configured behavior.
 * @param configuration custom configuration options
 */
public InternalSpelExpressionParser(SpelParserConfiguration configuration) {
	this.configuration = configuration;
}
 
Example #21
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Create a parser with some configured behavior.
 * @param configuration custom configuration options
 */
public InternalSpelExpressionParser(SpelParserConfiguration configuration) {
	this.configuration = configuration;
}
 
Example #22
Source File: StandardBeanExpressionResolver.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Create a new {@code StandardBeanExpressionResolver} with the given bean class loader,
 * using it as the basis for expression compilation.
 * @param beanClassLoader the factory's bean class loader
 */
public StandardBeanExpressionResolver(@Nullable ClassLoader beanClassLoader) {
	this.expressionParser = new SpelExpressionParser(new SpelParserConfiguration(null, beanClassLoader));
}
 
Example #23
Source File: StandardBeanExpressionResolver.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new {@code StandardBeanExpressionResolver} with the given bean class loader,
 * using it as the basis for expression compilation.
 * @param beanClassLoader the factory's bean class loader
 */
public StandardBeanExpressionResolver(ClassLoader beanClassLoader) {
	this.expressionParser = new SpelExpressionParser(new SpelParserConfiguration(null, beanClassLoader));
}
 
Example #24
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Create a parser with some configured behavior.
 * @param configuration custom configuration options
 */
public InternalSpelExpressionParser(SpelParserConfiguration configuration) {
	this.configuration = configuration;
}
 
Example #25
Source File: InternalSpelExpressionParser.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Create a parser with some configured behavior.
 * @param configuration custom configuration options
 */
public InternalSpelExpressionParser(SpelParserConfiguration configuration) {
	this.configuration = configuration;
}
 
Example #26
Source File: StandardBeanExpressionResolver.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Create a new {@code StandardBeanExpressionResolver} with the given bean class loader,
 * using it as the basis for expression compilation.
 * @param beanClassLoader the factory's bean class loader
 */
public StandardBeanExpressionResolver(@Nullable ClassLoader beanClassLoader) {
	this.expressionParser = new SpelExpressionParser(new SpelParserConfiguration(null, beanClassLoader));
}