Example usage for org.springframework.expression.spel SpelParserConfiguration SpelParserConfiguration

List of usage examples for org.springframework.expression.spel SpelParserConfiguration SpelParserConfiguration

Introduction

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

Prototype

public SpelParserConfiguration(boolean autoGrowNullReferences, boolean autoGrowCollections) 

Source Link

Document

Create a new SpelParserConfiguration instance.

Usage

From source file:com.fitbur.core.el.spring.internal.SpelParserConfigurationProvider.java

@Rank(Integer.MIN_VALUE)
@Singleton
@Override
public SpelParserConfiguration provide() {
    return new SpelParserConfiguration(false, false);
}

From source file:org.springframework.cloud.function.deployer.ApplicationRunner.java

public ApplicationRunner(ClassLoader classLoader, String source) {
    this.classLoader = classLoader;
    this.source = source;
    this.config = new SpelParserConfiguration(null, this.classLoader);
    this.typeLocator = new StandardTypeLocator(this.classLoader);
}

From source file:org.springframework.integration.ftp.inbound.FtpInboundRemoteFileSystemSynchronizerTests.java

@Test
public void testCopyFileToLocalDir() throws Exception {
    File localDirectoy = new File("test");
    assertFalse(localDirectoy.exists());

    TestFtpSessionFactory ftpSessionFactory = new TestFtpSessionFactory();
    ftpSessionFactory.setUsername("kermit");
    ftpSessionFactory.setPassword("frog");
    ftpSessionFactory.setHost("foo.com");
    FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer(ftpSessionFactory));
    synchronizer.setDeleteRemoteFiles(true);
    synchronizer.setRemoteDirectory("remote-test-dir");
    synchronizer.setFilter(new FtpRegexPatternFileListFilter(".*\\.test$"));
    synchronizer.setIntegrationEvaluationContext(ExpressionUtils.createStandardEvaluationContext());

    ExpressionParser expressionParser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
    Expression expression = expressionParser.parseExpression("#this.toUpperCase() + '.a'");
    synchronizer.setLocalFilenameGeneratorExpression(expression);

    FtpInboundFileSynchronizingMessageSource ms = new FtpInboundFileSynchronizingMessageSource(synchronizer);

    ms.setAutoCreateLocalDirectory(true);

    ms.setLocalDirectory(localDirectoy);
    ms.afterPropertiesSet();//from  w ww  .j a  v  a 2 s .  c om
    Message<File> atestFile = ms.receive();
    assertNotNull(atestFile);
    assertEquals("A.TEST.a", atestFile.getPayload().getName());
    Message<File> btestFile = ms.receive();
    assertNotNull(btestFile);
    assertEquals("B.TEST.a", btestFile.getPayload().getName());
    Message<File> nothing = ms.receive();
    assertNull(nothing);

    // two times because on the third receive (above) the internal queue will be empty, so it will attempt
    verify(synchronizer, times(2)).synchronizeToLocalDirectory(localDirectoy);

    assertTrue(new File("test/A.TEST.a").exists());
    assertTrue(new File("test/B.TEST.a").exists());
}