简体   繁体   中英

Error creating bean in spring

I'm getting the following error

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

I have the 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;
    }

What could be the reason for that? Highly appreciate your help.

Thank You

OK, found the correct answer. The method has some errors. The values pass should be setMaxPoolSize > setCorePoolSize in my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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