簡體   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