我收到以下错误
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。
@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;
}
这可能是什么原因? 非常感谢您的帮助。
谢谢
最佳答案
好的,找到正确答案了。该方法存在一些错误。在我的例子中,传递的值应该是 setMaxPoolSize > setCorePoolSize
。
关于java - Spring创建bean时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17941640/