zoukankan      html  css  js  c++  java
  • Java 配置全局线程池出错

    错误内容:

    Unsatisfied dependency expressed through field 'AAAAAAManager'; nested exception
    is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'AAAAAAManagerImpl':
    Unsatisfied dependency expressed through field 'globalThreadPoolExecutor'; nested exception is org.springframework.beans
    .factory.NoSuchBeanDefinitionException: No qualifying bean of type
    'java.util.concurrent.ThreadPoolExecutor' available: expected at least 1 bean which qualifies as autowire candidate.
    Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

    解决:

    在设置全局线程池中,需要在类开始位置设置:@Configuration注解

     

    globalThreadPoolExecutor函数需要设置 Bean注解
    @Bean
    ThreadPoolExecutor globalThreadPoolExecutor(){
    return new ThreadPoolExecutor(corePoolSize,
    maximumPoolSize,
    keepAliveTime,
    TimeUnit.SECONDS,
    new ArrayBlockingQueue<>(blockingQueueSize),
    Executors.defaultThreadFactory(),
    new ThreadPoolExecutor.DiscardPolicy());
    }
    团队五人,专业从事软件开发,接单工作,专注于Java,.Net,PHP
  • 相关阅读:
    React Native 架构演进
    React Native 架构一览
    React Native 在 Airbnb 的起起落落
    React Native简史
    图解云服务模型的演进
    伯克利研究员们眼中的Cloud Computing
    彻底理解 IaaS、PaaS、SaaS
    JS更随机的随机数
    JS自动化
    fingerprint2 计算浏览器指纹分析
  • 原文地址:https://www.cnblogs.com/xiaohouye/p/14735268.html
Copyright © 2011-2022 走看看