在 spring 中创建 bean 时出错

Rav*_*ndu 1 java spring javabeans maven

我收到以下错误

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
Run Code Online (Sandbox Code Playgroud)

我已经有了preTransactionHandlerPool豆子。

@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;
    }
Run Code Online (Sandbox Code Playgroud)

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

谢谢你

Rav*_*ndu 5

好的,找到正确答案。该方法有一些错误。setMaxPoolSize > setCorePoolSize在我的情况下,传递的值应该是。