How to get rid of the warning: `java.lang.RuntimeException: No beanFactory`

I am working on a project. My goal is to design a Spring IntegrationFlow using Version 6.3.2. that reads from a Sftp Server and splits and transforms the received XML files.

I have two simple SftpInbound IntegrationFlow Beans reading from a Sftp Server and feeding into a merging Flwo to process further. I get this warning.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>java.lang.RuntimeException: No beanFactory
at org.springframework.integration.expression.ExpressionUtils.createStandardEvaluationContext(ExpressionUtils.java:90) ~[spring-integration-core-6.3.2.jar:6.3.2]
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.afterPropertiesSet(AbstractInboundFileSynchronizer.java:290) ~[spring-integration-file-6.3.2.jar:6.3.2]
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.onInit(AbstractInboundFileSynchronizingMessageSource.java:200) ~[spring-integration-file-6.3.2.jar:6.3.2]
at org.springframework.integration.util.AbstractExpressionEvaluator.afterPropertiesSet(AbstractExpressionEvaluator.java:93) ~[spring-integration-core-6.3.2.jar:6.3.2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.2.jar:3.3.2]
at de.securess.utils.ihrrobotintegration.MainApplication.main(MainApplication.java:10) ~[classes/:na]
</code>
<code>java.lang.RuntimeException: No beanFactory at org.springframework.integration.expression.ExpressionUtils.createStandardEvaluationContext(ExpressionUtils.java:90) ~[spring-integration-core-6.3.2.jar:6.3.2] at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.afterPropertiesSet(AbstractInboundFileSynchronizer.java:290) ~[spring-integration-file-6.3.2.jar:6.3.2] at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.onInit(AbstractInboundFileSynchronizingMessageSource.java:200) ~[spring-integration-file-6.3.2.jar:6.3.2] at org.springframework.integration.util.AbstractExpressionEvaluator.afterPropertiesSet(AbstractExpressionEvaluator.java:93) ~[spring-integration-core-6.3.2.jar:6.3.2] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.11.jar:6.1.11] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.11.jar:6.1.11] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.11.jar:6.1.11] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.2.jar:3.3.2] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.2.jar:3.3.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.2.jar:3.3.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.2.jar:3.3.2] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.2.jar:3.3.2] at de.securess.utils.ihrrobotintegration.MainApplication.main(MainApplication.java:10) ~[classes/:na] </code>
java.lang.RuntimeException: No beanFactory
    at org.springframework.integration.expression.ExpressionUtils.createStandardEvaluationContext(ExpressionUtils.java:90) ~[spring-integration-core-6.3.2.jar:6.3.2]
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.afterPropertiesSet(AbstractInboundFileSynchronizer.java:290) ~[spring-integration-file-6.3.2.jar:6.3.2]
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.onInit(AbstractInboundFileSynchronizingMessageSource.java:200) ~[spring-integration-file-6.3.2.jar:6.3.2]
    at org.springframework.integration.util.AbstractExpressionEvaluator.afterPropertiesSet(AbstractExpressionEvaluator.java:93) ~[spring-integration-core-6.3.2.jar:6.3.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.11.jar:6.1.11]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971) ~[spring-context-6.1.11.jar:6.1.11]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.11.jar:6.1.11]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.2.jar:3.3.2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.2.jar:3.3.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.2.jar:3.3.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.2.jar:3.3.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.2.jar:3.3.2]
    at de.securess.utils.ihrrobotintegration.MainApplication.main(MainApplication.java:10) ~[classes/:na]

The code is working, but I would like to resolve the problem leading to the warning.
This is my @Configuration class:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@Configuration
public class SftpIntegrationConfig {
@Bean
public SessionFactory<SftpClient.DirEntry> sessionFactory() {
return getDirEntrySessionFactory();
}
SessionFactory<SftpClient.DirEntry> getDirEntrySessionFactory() {
DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory();
sessionFactory.setHost("localhost");
sessionFactory.setPort(22);
sessionFactory.setUser("test");
sessionFactory.setPassword("test");
sessionFactory.setAllowUnknownKeys(true);
sessionFactory.isSharedSession();
return new CachingSessionFactory<>(sessionFactory);
}
private SftpInboundFileSynchronizer createFileSynchronizer(String remoteDirectory) {
SftpInboundFileSynchronizer fileSynchronizer = new SftpInboundFileSynchronizer(sessionFactory());
fileSynchronizer.setDeleteRemoteFiles(true);
fileSynchronizer.setRemoteDirectory(remoteDirectory);
fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter("*.xml"));
return fileSynchronizer;
}
private MessageSource<File> sftpMessageSource(SftpInboundFileSynchronizer fileSynchronizer) {
SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource(fileSynchronizer);
source.setLocalDirectory(new File("C:\Users\jb\src\ihr-robot-integration\target_folder"));
source.setAutoCreateLocalDirectory(true);
source.setLocalFilter(new AcceptOnceFileListFilter<File>());
source.setMaxFetchSize(1);
return source;
}
@Bean
public MessageSource<File> sftpMessageSource987597720() {
return sftpMessageSource(createFileSynchronizer("data/987597720"));
}
@Bean
public MessageSource<File> sftpMessageSource999999999() {
return sftpMessageSource(createFileSynchronizer("data/999999999"));
}
@Bean
public IntegrationFlow sftpFlow987597720() {
return IntegrationFlow.from(sftpMessageSource987597720(),
c -> c.poller(Pollers.fixedDelay(10000)))
.channel("sftpChannel")
.get();
}
@Bean
public IntegrationFlow sftpFlow999999999() {
return IntegrationFlow.from(sftpMessageSource999999999(),
c -> c.poller(Pollers.fixedDelay(10000)))
.channel("sftpChannel")
.get();
}
@Bean
public IntegrationFlow mergedSftpFlow(){
return IntegrationFlow.from("sftpChannel")
.channel("processChannel")
.handle(message -> System.out.println(String.format("Processing new incoming file named: %s", message.getHeaders().get("file_name"))))
.get();
}
}
Can anybody help me with this warning?
It seems I can't find a clue in the documentation.
</code>
<code>@Configuration public class SftpIntegrationConfig { @Bean public SessionFactory<SftpClient.DirEntry> sessionFactory() { return getDirEntrySessionFactory(); } SessionFactory<SftpClient.DirEntry> getDirEntrySessionFactory() { DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory(); sessionFactory.setHost("localhost"); sessionFactory.setPort(22); sessionFactory.setUser("test"); sessionFactory.setPassword("test"); sessionFactory.setAllowUnknownKeys(true); sessionFactory.isSharedSession(); return new CachingSessionFactory<>(sessionFactory); } private SftpInboundFileSynchronizer createFileSynchronizer(String remoteDirectory) { SftpInboundFileSynchronizer fileSynchronizer = new SftpInboundFileSynchronizer(sessionFactory()); fileSynchronizer.setDeleteRemoteFiles(true); fileSynchronizer.setRemoteDirectory(remoteDirectory); fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter("*.xml")); return fileSynchronizer; } private MessageSource<File> sftpMessageSource(SftpInboundFileSynchronizer fileSynchronizer) { SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource(fileSynchronizer); source.setLocalDirectory(new File("C:\Users\jb\src\ihr-robot-integration\target_folder")); source.setAutoCreateLocalDirectory(true); source.setLocalFilter(new AcceptOnceFileListFilter<File>()); source.setMaxFetchSize(1); return source; } @Bean public MessageSource<File> sftpMessageSource987597720() { return sftpMessageSource(createFileSynchronizer("data/987597720")); } @Bean public MessageSource<File> sftpMessageSource999999999() { return sftpMessageSource(createFileSynchronizer("data/999999999")); } @Bean public IntegrationFlow sftpFlow987597720() { return IntegrationFlow.from(sftpMessageSource987597720(), c -> c.poller(Pollers.fixedDelay(10000))) .channel("sftpChannel") .get(); } @Bean public IntegrationFlow sftpFlow999999999() { return IntegrationFlow.from(sftpMessageSource999999999(), c -> c.poller(Pollers.fixedDelay(10000))) .channel("sftpChannel") .get(); } @Bean public IntegrationFlow mergedSftpFlow(){ return IntegrationFlow.from("sftpChannel") .channel("processChannel") .handle(message -> System.out.println(String.format("Processing new incoming file named: %s", message.getHeaders().get("file_name")))) .get(); } } Can anybody help me with this warning? It seems I can't find a clue in the documentation. </code>
@Configuration
public class SftpIntegrationConfig {

    @Bean
    public SessionFactory<SftpClient.DirEntry> sessionFactory() {
        return getDirEntrySessionFactory();
    }


    SessionFactory<SftpClient.DirEntry> getDirEntrySessionFactory() {
        DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory();
        sessionFactory.setHost("localhost");
        sessionFactory.setPort(22);
        sessionFactory.setUser("test");
        sessionFactory.setPassword("test");
        sessionFactory.setAllowUnknownKeys(true);
        sessionFactory.isSharedSession();
        return new CachingSessionFactory<>(sessionFactory);
    }

    private SftpInboundFileSynchronizer createFileSynchronizer(String remoteDirectory) {
        SftpInboundFileSynchronizer fileSynchronizer = new SftpInboundFileSynchronizer(sessionFactory());
        fileSynchronizer.setDeleteRemoteFiles(true);
        fileSynchronizer.setRemoteDirectory(remoteDirectory);
        fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter("*.xml"));
        return fileSynchronizer;
    }

    private MessageSource<File> sftpMessageSource(SftpInboundFileSynchronizer fileSynchronizer) {
        SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource(fileSynchronizer);
        source.setLocalDirectory(new File("C:\Users\jb\src\ihr-robot-integration\target_folder"));
        source.setAutoCreateLocalDirectory(true);
        source.setLocalFilter(new AcceptOnceFileListFilter<File>());
        source.setMaxFetchSize(1);
        return source;
    }

    @Bean
    public MessageSource<File> sftpMessageSource987597720() {
        return sftpMessageSource(createFileSynchronizer("data/987597720"));
    }

    @Bean
    public MessageSource<File> sftpMessageSource999999999() {
        return sftpMessageSource(createFileSynchronizer("data/999999999"));
    }

    @Bean
    public IntegrationFlow sftpFlow987597720() {

        return IntegrationFlow.from(sftpMessageSource987597720(),
                        c -> c.poller(Pollers.fixedDelay(10000)))
                .channel("sftpChannel")
                .get();
    }

    @Bean
    public IntegrationFlow sftpFlow999999999() {
        return IntegrationFlow.from(sftpMessageSource999999999(),
                        c -> c.poller(Pollers.fixedDelay(10000)))
                .channel("sftpChannel")
                .get();
    }

    @Bean
    public IntegrationFlow mergedSftpFlow(){
        return IntegrationFlow.from("sftpChannel")
                .channel("processChannel")
                .handle(message -> System.out.println(String.format("Processing new incoming file named: %s", message.getHeaders().get("file_name"))))
                .get();
    }

}

Can anybody help me with this warning? 
It seems I can't find a clue in the documentation.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật