Ravindu
Ravindu

Reputation: 2550

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

Upvotes: 1

Views: 991

Answers (1)

Ravindu
Ravindu

Reputation: 2550

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

Upvotes: 5

Related Questions