2013-07-30 133 views
0

我收到以下错误错误创建豆春季

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豆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; 
    } 

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

谢谢

+1

'IllegalArgumentException',很可能你喂它错误的数据。你能否在创建bean的时候发布更多的代码? – bas

+0

@bas编辑它为你说的 – Ravindu

+0

你确定''preTransactionHandlerPool“'是一个正确的值吗?这看起来好像是这种方法的非法论据。 – bas

回答

1

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