繁体   English   中英

在spring中创建bean时出错

[英]Error creating bean in spring

我收到以下错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'preTransactionHandlerPool' defined in class com.fg.transbridge.processor.spring.ContextConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException

我有preTransactionHandlerPool bean alredy。

@Bean(name = "preTransactionHandlerPool")
    public ThreadPoolTaskExecutor preTransactionHandlerPool() {

        LOGGER.info("Initializing preTransactionHandlerPool");
        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
        threadPoolTaskExecutor.setCorePoolSize(preTransCorePoolSize);
        threadPoolTaskExecutor.setMaxPoolSize(preTransMaxPoolSize);
        threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(preWaitForCompleteShutDown);
        LOGGER.debug("Initiated preTransactionHandlerPool");
        return threadPoolTaskExecutor;
    }

可能是什么原因? 非常感谢您的帮助。

谢谢

好的,找到了正确的答案。 该方法有一些错误。 在我的例子中,值pass应该是setMaxPoolSize > setCorePoolSize

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM