标签:none pool timeout tor def client bsp cli could not
1 org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userEmailController‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wf.emailservice.backend.service.core.IUserEmailService com.wf.emailservice.backend.web.controller.UserEmailController.userEmailService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userEmailService‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wf.emailservice.backend.service.core.IVivofsService com.wf.emailservice.backend.service.core.impl.UserEmailService.vivofsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘vivofsService‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.http.impl.client.CloseableHttpClient com.wf.emailservice.backend.service.core.impl.VivofsService.httpClient; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.http.impl.client.CloseableHttpClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
错误形式一: No qualifying bean of type [org.apache.http.impl.client.CloseableHttpClient] 无法找到相应的bean
1 No qualifying bean of type [org.apache.http.impl.client.CloseableHttpClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
1 org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userEmailController‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vivo.emailservice.backend.service.core.IUserEmailService com.vivo.emailservice.backend.web.controller.UserEmailController.userEmailService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userEmailService‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vivo.emailservice.backend.service.core.IVivofsService com.vivo.emailservice.backend.service.core.impl.UserEmailService.vivofsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘vivofsService‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.http.impl.client.CloseableHttpClient com.vivo.emailservice.backend.service.core.impl.VivofsService.httpClient; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.http.impl.client.CloseableHttpClient] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
这里主要原因是缺乏HttpClient的配置文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://www.springframework.org/schema/beans 5 http://www.springframework.org/schema/beans/spring-beans.xsd"> 6 7 <!-- 管理连接池 --> 8 <bean id="httpClientConnectionManager" class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" 9 destroy-method="close"> 10 <property name="maxTotal" value="150"/> 11 <!--目标主机的默认最大连接数--> 12 <property name="defaultMaxPerRoute" value="100"/> 13 </bean> 14 15 <!-- httpClient工厂--> 16 <bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder"> 17 <property name="connectionManager" ref="httpClientConnectionManager"/> 18 </bean> 19 20 <!-- httpClient对象--> 21 <bean id="httpClient" factory-bean="httpClientBuilder" factory-method="build" scope="prototype"> 22 </bean> 23 24 <!-- 请求配置工厂--> 25 <bean id="requestConfigBuilder" class="org.apache.http.client.config.RequestConfig.Builder"> 26 <!--http连接建立的超时时间--> 27 <property name="connectTimeout" value="1000"/> 28 <!--从连接池拿取连接的超时时间--> 29 <property name="connectionRequestTimeout" value="10"/> 30 <!--等待响应数据的超时时间--> 31 <property name="socketTimeout" value="1000"/> 32 </bean> 33 34 <!-- 请求配置的对象 --> 35 <bean id="requestConfig" factory-bean="requestConfigBuilder" factory-method="build"> 36 </bean> 37 38 39 </beans>
Maven+Spring+SpringMVC+Mybatis中的常见错误
标签:none pool timeout tor def client bsp cli could not
原文地址:http://www.cnblogs.com/piaxiaohui/p/7755211.html